Re: Nokia n900 and Euphoria
- Posted by SDPringle May 25, 2011
- 5227 views
I'd say it is an alignment issue. Is string_ptr a multiple of 4? If it comes from a file, probably not. You can't just say to the (ARM) procesor there is a floating point number at string_ptr unless string_ptr is a 4-byte aligned address. You can use memcpy to put it into a float declared in the function and then convert it to double.
Don't do this:
d = (double)*(float*)string_ptr; // attempt to load a float from an unaligned address.
nor this:
float f; f = *(float*)string_ptr; // attempt to load a float from an unaligned address. d = (double)f;
but you can do this:
float f; d = (double)*(float*)memcpy((void*)&f, (void*)string_ptr, 4);
So, where is your patch so far?