Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
fix Issue 22535 - ImportC: gcc/clang math intrinsics are rejected
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Jan 22, 2022
1 parent fb54942 commit 8083ef4
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/__builtins.d
Expand Up @@ -38,3 +38,23 @@ alias __builtin_va_copy = core.stdc.stdarg.va_copy;
/* dmd's ImportC rewrites __builtin_va_arg into an instantiation of va_arg
*/
alias va_arg = core.stdc.stdarg.va_arg;

/*********** floating point *************/

/* https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
*/

double __builtin_inf() { return double.infinity; }
float __builtin_inff() { return float.infinity; }
real __builtin_infl() { return real.infinity; }

alias __builtin_huge_val = __builtin_inf;
alias __builtin_huge_valf = __builtin_inff;
alias __builtin_huge_vall = __builtin_infl;

import core.stdc.math;

alias __builtin_fabs = core.stdc.math.fabs;
alias __builtin_fabsf = core.stdc.math.fabsf;
alias __builtin_fabsl = core.stdc.math.fabsl;

0 comments on commit 8083ef4

Please sign in to comment.