Merge branch 'master' into cors-support

This commit is contained in:
Cody Soyland 2018-05-29 11:38:54 -05:00 committed by GitHub
commit d50c2c9f72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1461,22 +1461,14 @@ func (c *Container) arrayMax() uint16 {
func (c *Container) bitmapMax() uint16 {
// Search bitmap in reverse order.
for i := len(c.bitmap) - 1; i >= 0; i-- {
for i := len(c.bitmap); i > 0; i-- {
// If value is zero then skip.
v := c.bitmap[i]
if v == 0 {
continue
v := c.bitmap[i-1]
if v != 0 {
r := bits.LeadingZeros64(v)
return uint16((i-1)*64 + 63 - r)
}
// Find the highest set bit.
for j := uint16(63); ; j-- {
if v&(1<<j) != 0 {
return uint16(i)*64 + j
}
if j == 0 {
break
}
}
}
return 0
}