Source File
intrinsics.go
Belonging Package
runtime/internal/sys
package sys
const deBruijn64ctz = 0x0218a392cd3d5dbf
var deBruijnIdx64ctz = [64]byte{
0, 1, 2, 7, 3, 13, 8, 19,
4, 25, 14, 28, 9, 34, 20, 40,
5, 17, 26, 38, 15, 46, 29, 48,
10, 31, 35, 54, 21, 50, 41, 57,
63, 6, 12, 18, 24, 27, 33, 39,
16, 37, 45, 47, 30, 53, 49, 56,
62, 11, 23, 32, 36, 44, 52, 55,
61, 22, 43, 51, 60, 42, 59, 58,
}
const deBruijn32ctz = 0x04653adf
var deBruijnIdx32ctz = [32]byte{
0, 1, 2, 6, 3, 11, 7, 16,
4, 14, 12, 21, 8, 23, 17, 26,
31, 5, 10, 15, 13, 20, 22, 25,
30, 9, 19, 24, 29, 18, 28, 27,
}
func ( uint64) int {
&= - // isolate low-order bit
:= * deBruijn64ctz >> 58 // extract part of deBruijn sequence
:= int(deBruijnIdx64ctz[]) // convert to bit index
:= int(( - 1) >> 57 & 64) // adjustment if zero
return +
}
func ( uint32) int {
&= - // isolate low-order bit
:= * deBruijn32ctz >> 27 // extract part of deBruijn sequence
:= int(deBruijnIdx32ctz[]) // convert to bit index
:= int(( - 1) >> 26 & 32) // adjustment if zero
return +
}
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |