From 640a3dac2b18d037169af15dfd5502c386c7e828 Mon Sep 17 00:00:00 2001 From: lemon Date: Fri, 26 May 2023 09:20:58 +0200 Subject: hm --- common.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'common.h') diff --git a/common.h b/common.h index ab3c8ff..2bd42bc 100644 --- a/common.h +++ b/common.h @@ -57,15 +57,19 @@ ptrhash(const void *p) { return (uint)(size_t)p * 2654435761; } static inline uint -popcnt(uint x) { +popcnt(uvlong x) { #ifdef __GNUC__ - return __builtin_popcount(x); + return __builtin_popcountll(x); #else uint n = 0; while (x) x >>= 1, ++n; return n; #endif } +static inline bool +ispo2(uvlong x) { + return (x & (x - 1)) == 0; +} /******************/ /* COMPILER STATE */ @@ -256,7 +260,7 @@ typearrlen(union type t) extern uchar targ_primsizes[]; extern uchar targ_primalign[]; -extern enum typetag targ_sizetype; +extern enum typetag targ_sizetype, targ_ptrdifftype; extern bool targ_charsigned, targ_bigendian; void targ_init(const char *targ); -- cgit v1.2.3