aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/soniakeys/graph/bits32.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/soniakeys/graph/bits32.go')
-rw-r--r--vendor/github.com/soniakeys/graph/bits32.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/vendor/github.com/soniakeys/graph/bits32.go b/vendor/github.com/soniakeys/graph/bits32.go
new file mode 100644
index 0000000..18e07f9
--- /dev/null
+++ b/vendor/github.com/soniakeys/graph/bits32.go
@@ -0,0 +1,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,
+}