diff options
| author | 2023-05-26 09:20:58 +0200 | |
|---|---|---|
| committer | 2023-05-26 09:20:58 +0200 | |
| commit | 640a3dac2b18d037169af15dfd5502c386c7e828 (patch) | |
| tree | 79e7ee3fa81e73855ce1bc78d7c4bf1ad3ac8f0d /common.h | |
| parent | 9100ed2b5dd01df8e6b766c7bc2a12c0dd44f1ff (diff) | |
hm
Diffstat (limited to 'common.h')
| -rw-r--r-- | common.h | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -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); |