NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: toolchain/53081: __BITMAP_* bitops macros broken with gcc 6.4
On Mar 8, 9:30am, martin%NetBSD.org@localhost (martin%NetBSD.org@localhost) wrote:
-- Subject: toolchain/53081: __BITMAP_* bitops macros broken with gcc 6.4
The fix to change the 1 to 1ul is incomplete:
#include <stdio.h>
#include <sys/types.h>
#include <sys/bitops.h>
int
main(void)
{
__BITMAP_TYPE(,unsigned long long, 256) bitmap;
// clear the whole bitmap
__BITMAP_ZERO(&bitmap);
// set a single bit
__BITMAP_SET(0, &bitmap);
__BITMAP_SET(63, &bitmap);
// show all bits that are set
for (size_t i = 0; i < 256; i++) {
if (!__BITMAP_ISSET(i, &bitmap))
continue;
printf("bit %zu is set\n", i);
}
// dump whole bitmap for examination
for (size_t i = 0; i < __arraycount(bitmap._b); i++)
printf("%zu: %016llx\n", i, bitmap._b[i]);
return 0;
}
[3:02pm] 1536>cc -m32 bm.c
[3:02pm] 1537>./a.out
bit 0 is set
bit 32 is set
0: 0000000000000001
1: 0000000000000000
2: 0000000000000000
3: 0000000000000000
christos
Home |
Main Index |
Thread Index |
Old Index