[Vm-dev] fdlibm is not C99 conformant

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Thu Dec 30 00:33:24 UTC 2010

2010/12/29 David T. Lewis <lewis at mail.msen.com>:
> On Wed, Dec 29, 2010 at 09:21:29PM +0100, Nicolas Cellier wrote:
>> Hi,
>> I suggest using replacements for __HI() and __LO() without illegal
>> pointer dereferencing.
>> One stupid possibility is to use an explicit memory copy, like in this
>> example: (see test_fdlibm.c attachment)
>> I've tested with:
>>     gcc -m64 -Wall -02 -D__LITTLE_ENDIAN test_fdlibm.c
>>     ./a.out
>> and obtained
>>     x=-3.14159
>> Of course, it'll be a bit slower, but we don't care.
>> More problematic is that we would have to change all the fdlibm sources...
> Thanks Nicolas,
> But the __HI and __LO macros look fine to me, and they seem to work as
> expected (see attached update to your test). Is there an alignment issue
> here that I'm missing?
> Dave

OK, got it, you have to compile with -D__LITTLE_ENDIAN
This macro is set automatically in fdlibm.h when compiled ith -m32 but
not when compiled with -m64


More information about the Vm-dev mailing list