All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sven Luther <luther@dpt-info.u-strasbg.fr>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Sven Luther <luther@dpt-info.u-strasbg.fr>,
	Linux Frame Buffer Device Development
	<linux-fbdev-devel@lists.sourceforge.net>
Subject: Re: writing to a floating point register ?
Date: Wed, 5 Feb 2003 11:38:37 +0100	[thread overview]
Message-ID: <20030205103837.GA817@iliana> (raw)
In-Reply-To: <Pine.GSO.4.21.0302051128310.16681-100000@vervain.sonytel.be>

On Wed, Feb 05, 2003 at 11:28:58AM +0100, Geert Uytterhoeven wrote:
> On Wed, 5 Feb 2003, Sven Luther wrote:
> > while writing a fbdev driver, i need to write a value to a floating
> > point register. Do we have any macro doing this, or should i need to
> > calculate the sign, mantissa and exponent by hand ?
> > 
> > Just doing a unsigned int cast would round the value i think, and thus
> > not give the right result.
> 
> You cannot use floating point math in the kernel.
> 
> What exactly are you trying to achieve?

Well, my framebuffer is not linear, and i have to enable a bypass unit
to fake a linear framebuffer. This bypass unit need that i write the
bytestride/64 32bit floating point value in a register.

for example : 1024 in 32 bpp => 4*1024/64 = 64.

64 is 0100 0000 or 1.0 * 2^6.

So i have sign = 0, exp = 127+6=133 = 10000101, and mantissa = 0.

which gives 0100 0010 1000 0000 ... or 0x42 80 00 00.

I was hoping that i would not need to do this calculation by hand, but i
guess it is not possible, since like you said, we cannot use the FP
unit in the kernel.

Or maybe there are some convenient macros available for that or
something ?

Friendly,

Sven Luther


-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com

  reply	other threads:[~2003-02-05 10:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-05 10:17 writing to a floating point register ? Sven Luther
2003-02-05 10:28 ` Geert Uytterhoeven
2003-02-05 10:38   ` Sven Luther [this message]
2003-02-05 10:44     ` Geert Uytterhoeven
2003-02-05 11:02       ` Sven Luther
2003-02-05 12:04       ` Sven Luther

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030205103837.GA817@iliana \
    --to=luther@dpt-info.u-strasbg.fr \
    --cc=geert@linux-m68k.org \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.