diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2016-01-05 06:58:38 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2016-01-05 06:58:38 +0000 |
commit | 60ab25645e64e5e054d9b101091e3b1abd87d36e (patch) | |
tree | ca015b3f34b97fbc685f1703e6f08641fae9eda5 /src | |
parent | 4d4ea18bff322b4e4933e57de93cccbf81852557 (diff) | |
download | skalibs-60ab25645e64e5e054d9b101091e3b1abd87d36e.tar.xz |
Fix incorrect clear/set when b&7 = 0 in bitarray_clearsetn (thx jjk)
Diffstat (limited to 'src')
-rw-r--r-- | src/libstddjb/bitarray_clearsetn.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libstddjb/bitarray_clearsetn.c b/src/libstddjb/bitarray_clearsetn.c index b3f46f1..d14d6e4 100644 --- a/src/libstddjb/bitarray_clearsetn.c +++ b/src/libstddjb/bitarray_clearsetn.c @@ -8,7 +8,7 @@ void bitarray_clearsetn (register unsigned char *s, register unsigned int a, reg b += a ; if ((a >> 3) == ((b-1) >> 3)) { - register unsigned char mask = ((1 << (a & 7)) - 1) ^ ((1 << (b & 7)) - 1) ; + register unsigned char mask = (1 << (a & 7)) - 1 ^ (1 << 1 + (b-1 & 7)) - 1 ; if (h) s[a>>3] |= mask ; else s[a>>3] &= ~mask ; } else |