linux-fbdev.vger.kernel.org archive mirror
 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 13:04:58 +0100	[thread overview]
Message-ID: <20030205120458.GA1428@iliana> (raw)
In-Reply-To: <Pine.GSO.4.21.0302051140460.16681-100000@vervain.sonytel.be>

On Wed, Feb 05, 2003 at 11:44:23AM +0100, Geert Uytterhoeven wrote:
> 
> Even if you could, it would work for 32-bit IEEE floating point format only.
> Is the hardware register format IEEE compatible.


Something like this :

unsigned long cfp32(unsigned long v, unsigned long d) {
        unsigned int x, vx, m, e;
        for (x=0, vx=v; vx>1; x++, vx>>=1);
        m = (x>22?v>>(x-22):v<<(22-x)) & 0x007fffff;
        e = ((x+127-d)<<23) & 0x7f800000;
        return (e | m);
}

Does the job. I don't really test for exponent overflow, but well,
anyone trying a video mode whose exponent is greater than 127 deserves
what gets.

Are there any other subtle things that may break with the above ?

Anyway thanks for your help.

Friendly,

Sven Luther


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

      parent reply	other threads:[~2003-02-05 12:05 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
2003-02-05 10:44     ` Geert Uytterhoeven
2003-02-05 11:02       ` Sven Luther
2003-02-05 12:04       ` Sven Luther [this message]

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=20030205120458.GA1428@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).