]> git.llucax.com Git - software/dgc/cdgc.git/commitdiff
Use integer division to calculate the bit position
authorLeandro Lucarella <llucax@gmail.com>
Sun, 29 Aug 2010 05:29:59 +0000 (02:29 -0300)
committerLeandro Lucarella <llucax@gmail.com>
Sun, 29 Aug 2010 05:29:59 +0000 (02:29 -0300)
Any decent compiler can optimize the division by a power of 2 to a shift.

rt/gc/cdgc/gc.d

index 3122215731cf726809ed8ac9abef0ad0ed5ba5f0..432aab9de01db36bf80bbfce2f1404edc10510f2 100644 (file)
@@ -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)
 
                 // 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
                 else if (bin == B_PAGEPLUS)
                 {
                     do