From: Leandro Lucarella Date: Sun, 29 Aug 2010 05:29:59 +0000 (-0300) Subject: Use integer division to calculate the bit position X-Git-Url: https://git.llucax.com/software/dgc/cdgc.git/commitdiff_plain/192f4bfd2ffdaa5e6283bc16e8452fc3c218fb8a?ds=sidebyside Use integer division to calculate the bit position Any decent compiler can optimize the division by a power of 2 to a shift. --- diff --git a/rt/gc/cdgc/gc.d b/rt/gc/cdgc/gc.d index 3122215..432aab9 100644 --- a/rt/gc/cdgc/gc.d +++ b/rt/gc/cdgc/gc.d @@ -651,7 +651,7 @@ void mark_range(void *pbot, void *ptop, size_t* pm_bitmask) // Adjust bit to be at start of allocated memory block if (bin <= B_PAGE) - bit_i = (offset & notbinsize[bin]) >> 4; + bit_i = (offset & notbinsize[bin]) / 16; else if (bin == B_PAGEPLUS) { do