2 * D header file for DragonFlyBSD.
4 * Authors: Martin Nowak, Diederik de Groot(port:DragonFlyBSD)
5 * Copied: From core/sys/freebsd/sys
7 module core.sys.dragonflybsd.sys._bitset;
9 version (DragonFlyBSD):
10 extern (C) pure nothrow @nogc @system:
12 import core.stdc.config : c_long;
14 enum NBBY = 8; // number of bits per byte
16 enum _BITSET_BITS = c_long.sizeof * NBBY;
18 enum __bitset_words(size_t s) = (s + _BITSET_BITS - 1) / _BITSET_BITS;
20 c_long __bitset_mask(size_t s)(size_t n)
22 static if (__bitset_words!s == 1)
23 return (cast(c_long)1) << n;
25 return (cast(c_long)1) << n % _BITSET_BITS;
28 size_t __bitset_word(size_t s)(size_t n)
30 static if (__bitset_words!s == 1)
33 return n / _BITSET_BITS;
36 struct BITSET_DEFINE(size_t s)
38 c_long[__bitset_words!s] __bits;
41 // no idea how to translate those
42 //#define BITSET_T_INITIALIZER(x) \
43 // { .__bits = { x } }
45 //#define BITSET_FSET(n) \
46 // [ 0 ... ((n) - 1) ] = (-1L)