GrafX2 2.9.3227
The ultimate 256-color painting program
bitcount.h File Reference

helper functions (or macros) to count bits in machine words More...

+ This graph shows which files directly or indirectly include this file:

Functions

static int count_set_bits (unsigned int value)
 Count the number of bit sets "Popcount". More...
 
static int count_trailing_zeros (unsigned int value)
 Count the number of low order zero's before the first bit set. More...
 

Detailed Description

helper functions (or macros) to count bits in machine words

Function Documentation

◆ count_set_bits()

static int count_set_bits ( unsigned int  value)
static

Count the number of bit sets "Popcount".

Based on Wikipedia article for Hamming_weight, it's optimized for cases when zeroes are more frequent.

Referenced by C64_FLI(), C64_pixels_to_FLI(), Load_BMP_Pixels(), and Load_ClipBoard_Image().

◆ count_trailing_zeros()

static int count_trailing_zeros ( unsigned int  value)
static

Count the number of low order zero's before the first bit set.

Referenced by C64_pixels_to_FLI(), Load_BMP_Pixels(), and Load_ClipBoard_Image().