popcount

package
v0.0.0-...-94c99f4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2019 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

The expression `x&(x-1)` clears the rightmost non-zero bit of x. Write a version of `PopCount` that counts bits by using this fact, and assess its performance.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByClearing

func ByClearing(x uint64) int

ByClearing returns the population count (number of set bits) of x by clearing.

func ByLookup

func ByLookup(x uint64) int

ByLookup returns the population count (number of set bits) of x.

func ByShifting

func ByShifting(x uint64) int

ByShifting returns the population count (number of set bits) of x by shifting.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL