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//go:build amd64 && !appengine && !gccgo 6// +build amd64,!appengine,!gccgo 7 8package intsets 9 10func popcnt(x word) int 11func havePOPCNT() bool 12 13var hasPOPCNT = havePOPCNT() 14 15// popcount returns the population count (number of set bits) of x. 16func popcount(x word) int { 17 if hasPOPCNT { 18 return popcnt(x) 19 } 20 return popcountTable(x) // faster than Hacker's Delight 21} 22