Vector Optimized Library of Kernels  3.0.0
Architecture-tuned implementations of math kernels

Overview

Computes the population count (popcnt), or Hamming distance of a binary string. This kernel takes in a single unsigned 32-bit value and returns the count of 1's that the value contains.

Dispatcher Prototype

void volk_32u_popcnt(uint32_t* ret, const uint32_t value)

Inputs

  • value: The input value.

Outputs

  • ret: The return value containing the popcnt.

Example

int N = 10;
unsigned int alignment = volk_get_alignment();
uint32_t bitstring = 0x55555555;
uint32_t hamming_distance = 0;
volk_32u_popcnt(&hamming_distance, bitstring);
printf("hamming distance of %x = %i\n", bitstring, hamming_distance);
size_t volk_get_alignment(void)
Get the machine alignment in bytes.
Definition: volk.tmpl.c:90