1 /* ISC license. */ 2 3 #include <skalibs/bitarray.h> 4 bitarray_not(unsigned char * s,size_t a,size_t b)5void bitarray_not (unsigned char *s, size_t a, size_t b) 6 { 7 if (!b) return ; 8 b += a ; 9 if ((a >> 3) == ((b-1) >> 3)) 10 s[a>>3] ^= ((1 << (a & 7)) - 1) ^ ((a << (b & 7)) - 1) ; 11 else 12 { 13 size_t i = (a>>3) + 1 ; 14 s[a>>3] ^= ~((1 << (a & 7)) - 1) ; 15 for (; i < (b>>3) ; i++) s[i] = ~s[i] ; 16 s[b>>3] ^= (1 << (b & 7)) - 1 ; 17 } 18 } 19