core: add bitop implementations for darwin and linux

This commit is contained in:
2024-11-14 18:32:58 +00:00
parent d614e110df
commit 46d3ded0f6
2 changed files with 32 additions and 0 deletions

16
core/sys/darwin/bitop.c Normal file
View File

@@ -0,0 +1,16 @@
#include <blue/core/bitop.h>
int b_popcountl(long v)
{
return __builtin_popcountl(v);
}
int b_ctzl(long v)
{
return __builtin_ctzl(v);
}
int b_clzl(long v)
{
return __builtin_clzl(v);
}

16
core/sys/linux/bitop.c Normal file
View File

@@ -0,0 +1,16 @@
#include <blue/core/bitop.h>
int b_popcountl(long v)
{
return __builtin_popcountl(v);
}
int b_ctzl(long v)
{
return __builtin_ctzl(v);
}
int b_clzl(long v)
{
return __builtin_clzl(v);
}