STDC_COUNT_ZEROS(3)
β¨ STDC_COUNT_ZEROS(3) β¨
okay so this is the STDC_COUNT_ZEROS(3) page, and it lives in the Library Functions Manual. it's giving niche-bit-math main character energy, and honestly? we're here for it. π
β¨
πΈ NAME πΈ
stdc_count_zeros β count the zeros in an integer. no cap, that's the whole name vibe. π
π¦ SYNOPSIS π¦
okay bestie, here's the exact synopsis β do not let the _uc / _us / _ui / _ul / _ull alphabet soup scare you. iykyk. π«Ά
Standard C Library (libc, -lc) #include <stdbit.h>
unsigned int
stdc_count_zeros_uc(unsigned char value);
unsigned int
stdc_count_zeros_us(unsigned short value);
unsigned int
stdc_count_zeros_ui(unsigned int value);
unsigned int
stdc_count_zeros_ul(unsigned long value);
unsigned int
stdc_count_zeros_ull(unsigned long long value);
unsigned int
stdc_count_zeros(value);
π DESCRIPTION π
The stdc_count_zeros_type() family of functions returns the number of bits set to 0 in value, where value is of type unsigned char, unsigned short, unsigned int, unsigned long, or unsigned long long for type being uc, us, ui, ul, or ull respectively. π
This is also known as the βpopulation countβ (popcount) or βHamming weightβ of the complement of value. yes, we're counting the zero bits and calling it fancy. β¨
The stdc_count_zeros(value) type-generic macro picks the appropriate stdc_count_zeros_type() function based on the type of value. the way it just knows? obsessed. π«Ά
π RETURN VALUES π
Returns the number of bits set to 0 in value. fr fr, that's the whole return value. highkey perfect. π
π SEE ALSO π
stdbit(3)π¦stdc_count_ones(3)π¦
π STANDARDS π
The stdc_count_zeros_type() family of functions and the stdc_count_zeros() type-generic macro conform to . π
standards vibe check: yes, it literally ends with conform to . β that lonely period is canon, bestie. π
π¦ HISTORY π¦
The stdc_count_zeros_type() family of functions and the stdc_count_zeros() type-generic macro were added in FreeBSD 15.1. slay. π
π AUTHOR π
Robert Clausecker <fuz@FreeBSD.org> β thank you for this zero-counting gift, legend. π«Ά
xoxo bestie, this was STDC_COUNT_ZEROS(3) β brought to you by Debian and dated November 9, 2025. now go count some zeros, periodt. ππ
β¨
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π the page's license: BSD-2-Clause
- Copyright (c) 2025 Robert Clausecker <fuz@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms