Hi Joerg, The long double to be parsed are the bit pattern of long double in hexadecimal. For example, 4001a000000000000000 in the mangled name stands for 0xap-1L (i.e. 5.0)
To properly guard this test case, I have to know the number of bits of long double, and it seems that __LDBL_MANT_DIG__ is not for this purpose. Although using __SIZEOF_LONG_DOUBLE__ is not a perfect solution, since the additional padding might result in the overestimation of the number of bits. But it is sufficient to distinguish the targets as far as I know. Both 12 and 16 are fine for the test case. If you wish to have more information, you can check the parse_floating_number() function in src/cxa_demangle.cpp. Sincerely, Logan On Wed, May 7, 2014 at 3:33 AM, Joerg Sonnenberger <[email protected]>wrote: > On Wed, May 07, 2014 at 12:14:32AM +0800, Logan Chien wrote: > > > Can you use __LDBL_MANT_DIG__ == 64 instead? > > > > > > > It seems that __LDBL_MANT_DIG__ stands for the number of bits of > > significand (or mantissa.) However, I wish to know the size of long > > double. AFAIK, there is no macro for this. Any good suggestion? > Thanks. > > Problem is that the size of long double may include additional padding, > so it gets rounded up to 12 or 16 bytes. On AMD64, you will get a size > of 16 bytes for SPARC64 as well, but it has a different encoding. > > Joerg > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
