Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/builtin.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ enum BUILTIN FuncDeclaration::isBuiltin()
static const char FeZe [] = "FNaNbNfeZe"; // @safe pure nothrow real function(real)
static const char FeZe2[] = "FNaNbNeeZe"; // @trusted pure nothrow real function(real)

//printf("FuncDeclaration::isBuiltin() %s\n", toChars());
//printf("FuncDeclaration::isBuiltin() %s, %d\n", toChars(), builtin);
if (builtin == BUILTINunknown)
{
builtin = BUILTINnot;
if (parent && parent->isModule())
{
// If it's in the std.math package
if (parent->ident == Id::math &&
parent->parent && parent->parent->ident == Id::std &&
parent->parent && (parent->parent->ident == Id::std || parent->parent->ident == Id::core) &&
!parent->parent->parent)
{
//printf("deco = %s\n", type->deco);
Expand Down
1 change: 1 addition & 0 deletions src/idgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ Msgtable msgtable[] =

// Builtin functions
{ "std" },
{ "core" },
{ "math" },
{ "sin" },
{ "cos" },
Expand Down
38 changes: 37 additions & 1 deletion src/toir.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,18 @@ int intrinsic_op(char *name)
#ifdef DMDV2
static const char *core_namearray[] =
{
"4math3cosFNaNbNfeZe",
"4math3sinFNaNbNfeZe",
"4math4fabsFNaNbNfeZe",
"4math4rintFNaNbNfeZe",
"4math4sqrtFNaNbNfdZd",
"4math4sqrtFNaNbNfeZe",
"4math4sqrtFNaNbNffZf",
"4math4yl2xFNaNbNfeeZe",
"4math5ldexpFNaNbNfeiZe",
"4math6rndtolFNaNbNfeZl",
"4math6yl2xp1FNaNbNfeeZe",

"5bitop2btFNaNbxPkkZi",
"5bitop3bsfFNaNbkZi",
"5bitop3bsrFNaNbkZi",
Expand All @@ -504,6 +516,18 @@ int intrinsic_op(char *name)
};
static const char *core_namearray64[] =
{
"4math3cosFNaNbNfeZe",
"4math3sinFNaNbNfeZe",
"4math4fabsFNaNbNfeZe",
"4math4rintFNaNbNfeZe",
"4math4sqrtFNaNbNfdZd",
"4math4sqrtFNaNbNfeZe",
"4math4sqrtFNaNbNffZf",
"4math4yl2xFNaNbNfeeZe",
"4math5ldexpFNaNbNfeiZe",
"4math6rndtolFNaNbNfeZl",
"4math6yl2xp1FNaNbNfeeZe",

"5bitop2btFNaNbxPmmZi",
"5bitop3bsfFNaNbmZi",
"5bitop3bsrFNaNbmZi",
Expand All @@ -520,6 +544,18 @@ int intrinsic_op(char *name)
};
static unsigned char core_ioptab[] =
{
OPcos,
OPsin,
OPabs,
OPrint,
OPsqrt,
OPsqrt,
OPsqrt,
OPyl2x,
OPscale,
OPrndtol,
OPyl2xp1,

OPbt,
OPbsf,
OPbsr,
Expand Down Expand Up @@ -589,7 +625,7 @@ int intrinsic_op(char *name)
}
#ifdef DMDV2
if (length > 12 &&
name[8] == 'b' &&
(name[8] == 'm' || name[8] == 'b') &&
!memcmp(name, "_D4core", 7))
{
int i = binary(name + 7, I64 ? core_namearray64 : core_namearray, sizeof(core_namearray) / sizeof(char *));
Expand Down