aboutsummaryrefslogtreecommitdiffhomepage
path: root/common.h
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-12-28 19:02:39 +0100
committerlemon <lsof@mailbox.org>2025-12-28 19:02:39 +0100
commit17b4861e53fd5be2107f3b7fd8bf77f3d2cc15da (patch)
tree019743c333bb6001edd9eb8e639163b6236f24f4 /common.h
parent0378ccf92c3c1896af29900039339a077c8b5502 (diff)
backend: start implementing aarch64
Diffstat (limited to 'common.h')
-rw-r--r--common.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/common.h b/common.h
index 9804447..ac4bc88 100644
--- a/common.h
+++ b/common.h
@@ -73,7 +73,7 @@ ptrhash(const void *p) {
static inline uint
popcnt(uvlong x) {
#if HAS_BUILTIN(popcountll)
- return __builtin_popcountll(x);
+ return x ? __builtin_popcountll(x) : 0;
#else
uint n = 0;
while (x) n += x&1, x >>= 1;
@@ -86,7 +86,7 @@ ispo2(uvlong x) {
}
static inline uint
ilog2(uvlong x) { /* assumes x is a power of 2 */
-#if HAS_BUILTIN(ctz)
+#if HAS_BUILTIN(ctzll)
return __builtin_ctzll(x);
#else
uint n = 0;
@@ -97,7 +97,7 @@ ilog2(uvlong x) { /* assumes x is a power of 2 */
static inline uint
lowestsetbit(uvlong x)
{
-#if HAS_BUILTIN(ctz)
+#if HAS_BUILTIN(ctzll)
return __builtin_ctzll(x);
#else
int i = 0;
@@ -163,7 +163,7 @@ extern struct inclpaths {
/**********/
struct targtriple {
- enum mcarch { ISxxx, ISx86_64 } arch;
+ enum mcarch { ISxxx, ISx86_64, ISaarch64 } arch;
enum mcos { OSunknown, OSlinux } os;
enum mcabi { ABInone, ABIgnu, ABImusl } abi;
};