log2 computes the binary logarithm of x, rounded up to the next integer.
(i uintptr)
| 24 | |
| 25 | // log2 computes the binary logarithm of x, rounded up to the next integer. |
| 26 | func log2(i uintptr) uintptr { |
| 27 | var n, p uintptr |
| 28 | for p = 1; p < i; p += p { |
| 29 | n++ |
| 30 | } |
| 31 | return n |
| 32 | } |