diff --git a/alloc.go b/alloc.go index 52887f6..9e3acf3 100644 --- a/alloc.go +++ b/alloc.go @@ -7,7 +7,7 @@ import ( var ( defaultAllocator *Allocator - debruijinPos = [...]byte{0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9} + debruijinPos = [...]byte{0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31} ) func init() { @@ -68,6 +68,5 @@ func msb(size int) byte { v |= v >> 4 v |= v >> 8 v |= v >> 16 - v = (v >> 1) + 1 - return debruijinPos[(v*0x077CB531)>>27] + return debruijinPos[(v*0x07C4ACDD)>>27] }