popcount

package
v0.0.0-...-6fe4f4e Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: MIT Imports: 1 Imported by: 0

README

Exercise 9.2 (P271)

Rewrite the PopCount example from Section 2.6.2 so that it initializes the lookup table using sync.Once the first time it is needed. (Realistically, the cost of synchronization whould be prohibitive for a small and highly optimized function like PopCount)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PopCountLoop

func PopCountLoop(x uint64) int

PopCountLoop returns the population count (number of set bits) of x by looping.

func PopCountTable

func PopCountTable(x uint64) int

PopCountTable returns the population count (number of set bits) of x by table-lookup.

func PopCountTableSync

func PopCountTableSync(x uint64) int

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳