github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/tools/container/intsets/popcnt_amd64.go (about) 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 }