Messages in this thread | | | Date | Mon, 28 Nov 2011 12:50:38 +0000 | From | Paulo Marques <> | Subject | Re: Floating point usage inside kernel |
| |
Nuno Santos wrote: > Ok, understood! > > Just one more question. To do this, do I need to change the data type > from double to int?
You shouldn't have any "double" declarations on kernel code or the compiler might start using floating point instructions to handle it.
Things that the compiler can work out at compile time are probably ok, like converting constants:
#define FIXED(a) (s32)((a) * 65536.0)
fixed = FIXED(1.25);
In this case compiler should make all the calculations at compile time and replace the macro "FIXED(1.25)" with the integer 81920.
-- Paulo Marques - www.grupopie.com
"Don't worry, you'll be fine; I saw it work in a cartoon once..."
| |