99ea813d28491ff2d795a76cd3e27d70addd9127
[dotfiles/.git] / popcnt_amd64.go
1 // Copyright 2015 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 // +build amd64,!appengine,!gccgo
6
7 package intsets
8
9 func popcnt(x word) int
10 func havePOPCNT() bool
11
12 var hasPOPCNT = havePOPCNT()
13
14 // popcount returns the population count (number of set bits) of x.
15 func popcount(x word) int {
16         if hasPOPCNT {
17                 return popcnt(x)
18         }
19         return popcountTable(x) // faster than Hacker's Delight
20 }