aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/soniakeys/graph/bits32.go
blob: 18e07f9a4b76a9b8e6afdb18f2ddcd770bfedc95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright 2014 Sonia Keys
// License MIT: http://opensource.org/licenses/MIT

// +build 386 arm

package graph

// "word" here is math/big.Word
const (
	wordSize = 32
	wordExp  = 5 // 2^5 = 32
)

// deBruijn magic numbers used in trailingZeros()
//
// reference: http://graphics.stanford.edu/~seander/bithacks.html
const deBruijnMultiple = 0x077CB531
const deBruijnShift = 27

var deBruijnBits = []int{
	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,
}