Re: writing to a floating point register ?
flat view
From: Sven Luther <hidden>
Date: 2003-02-05 12:05:14
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