invariant
{
if (data)
- {
- assert(nwords * data[0].sizeof * 8 >= nbits);
- }
+ assert (nwords ==
+ ((nbits + (BITS_PER_WORD - 1)) >> BITS_SHIFT));
}
void alloc(size_t nbits, os.Vis vis = os.Vis.PRIV)
void zero()
{
- version(MEMCPY_NON_SIG_SAFE) {
- uint * d1=data+1,dEnd=d1+nwords;
- for (;d1!=dEnd;++d1)
- *d1=0u;
- } else {
- cstring.memset(data + 1, 0, nwords * uint.sizeof);
- }
+ cstring.memset(data + 1, 0, nwords * uint.sizeof);
+ }
+
+ void set_all()
+ {
+ cstring.memset(data + 1, 0xff, nwords * uint.sizeof);
+ }
+
+ void set_group(size_t base, size_t nbits)
+ in
+ {
+ }
+ body
+ {
+ assert ((base % 8) == 0);
+ assert ((nbits % 8) == 0);
+ size_t nbytes = nbits / 8;
+ cstring.memset(data + 1 + (base >> BITS_SHIFT), 0xff, nbytes);
}
void copy(GCBits *f)
}
body
{
- version(MEMCPY_NON_SIG_SAFE) {
- uint * d1=data+1,d2=f.data+1,dEnd=d1+nwords;
- for (;d1!=dEnd;++d1,++d2)
- *d1=*d2;
- } else {
- cstring.memcpy(data + 1, f.data + 1, nwords * uint.sizeof);
- }
+ cstring.memcpy(data + 1, f.data + 1, nwords * uint.sizeof);
}
uint* base()