X-Git-Url: https://git.llucax.com/software/dgc/cdgc.git/blobdiff_plain/d8944d1a3011a7b9b2ffcebf41fdb5d6d3b03467..c216b75a02d7b09c6949be6ec102b5557a060c08:/rt/gc/cdgc/bits.d diff --git a/rt/gc/cdgc/bits.d b/rt/gc/cdgc/bits.d index 3dd8f34..7c06c83 100644 --- a/rt/gc/cdgc/bits.d +++ b/rt/gc/cdgc/bits.d @@ -83,9 +83,8 @@ struct GCBits 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) @@ -163,13 +162,24 @@ struct GCBits 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) @@ -179,13 +189,7 @@ struct GCBits } 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()