aboutsummaryrefslogtreecommitdiffhomepage
path: root/common.h
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2023-06-14 15:05:43 +0200
committerlemon <lsof@mailbox.org>2023-06-14 15:05:43 +0200
commit782d4e9df0363ca9f64d8b92a3d6952d552f13a5 (patch)
tree8c71e107a8c0b54f53c2c94d053ad4cc1b7a441d /common.h
parent8d8cf6584bf4081b54cd91fcaa42578cbd794440 (diff)
add spilling for function calls, misc fixes
Diffstat (limited to 'common.h')
-rw-r--r--common.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/common.h b/common.h
index 3628c89..a486426 100644
--- a/common.h
+++ b/common.h
@@ -62,7 +62,7 @@ popcnt(uvlong x) {
return __builtin_popcountll(x);
#else
uint n = 0;
- while (x) x >>= 1, ++n;
+ while (x) n += x&1, x >>= 1;
return n;
#endif
}
@@ -375,13 +375,13 @@ bstest(const struct bitset *bs, uint i)
static inline void
bsset(struct bitset *bs, uint i)
{
- bs[i / BSNBIT].u |= 1 << i % BSNBIT;
+ bs[i / BSNBIT].u |= 1ull << i % BSNBIT;
}
static inline void
bsclr(struct bitset *bs, uint i)
{
- bs[i / BSNBIT].u &= ~(1 << i % BSNBIT);
+ bs[i / BSNBIT].u &= ~(1ull << i % BSNBIT);
}
static inline void