ImportC and #include files
jmh530
john.michael.hall at gmail.com
Mon May 8 18:58:13 UTC 2023
On Monday, 8 May 2023 at 17:54:45 UTC, bachmeier wrote:
> On Monday, 8 May 2023 at 17:29:38 UTC, jmh530 wrote:
>
>> [...]
>
> Looks like that's gcc:
>
> https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html#index-_005f_005fbuiltin_005fhuge_005fval
>
> Probably requires an addition to importc.h, as has been done
> for several other cases already:
>
> https://github.com/dlang/dmd/blob/master/druntime/src/importc.h#L79
Something like below might be worth adding
#define __builtin_huge_val double.infinity
#define __builtin_huge_valf float.infinity
#define __builtin_huge_vall real.infinity
#define __builtin_inf double.infinity
#define __builtin_inff float.infinity
#define __builtin_infl real.infinity
#define __builtin_nan double.nan
#define __builtin_nanf float.nan
#define __builtin_nanl real.nan
DRuntime implements HUGE_VAL this way, though some reference
materials say that it behaves differently on machines that don't
have infinity defined. So it's a bit legacy.
Here's a potentially incomplete list of some things that would
need to be defined to cover most of the rest of core.stdc.math:
FP_ILOGB0
FP_ILOGBNAN
__builtin_signbit
__builtin_fpclassify
__builtin_isfinite
__builtin_isnormal
__builtin_isgreaterequal
__builtin_isless
__builtin_islessequal
__builtin_islessgreater
__builtin_isunordered
More information about the Digitalmars-d
mailing list