summaryrefslogtreecommitdiff
path: root/util/bitset.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2017-01-15 00:25:13 -0800
committerOri Bernstein <ori@eigenstate.org>2017-01-15 00:25:13 -0800
commit0893bfe6bde2b9498a32354894b003adc13a9ea9 (patch)
tree698b857da3be2cf802b147f9deb60d1060cc57de /util/bitset.c
parent4078198dee11c72b6e735e704d21a2c0f39cb575 (diff)
downloadmc-0893bfe6bde2b9498a32354894b003adc13a9ea9.tar.gz
Back to a 9front C subset.
Diffstat (limited to 'util/bitset.c')
-rw-r--r--util/bitset.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/util/bitset.c b/util/bitset.c
index 31049bf..c69269a 100644
--- a/util/bitset.c
+++ b/util/bitset.c
@@ -109,6 +109,9 @@ size_t bscount(Bitset *bs)
inline static int firstbit(size_t b)
{
int n;
+ static const char bits[] = {
+ 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
+ };
n = 0;
if (!(b & 0xffffffff)) {
@@ -127,7 +130,7 @@ inline static int firstbit(size_t b)
n += 4;
b >>= 4;
}
- n += (char[16]){4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0}[b & 0xf];
+ n += bits[b & 0xf];
return n;
}