STDC_TRAILING_ONES(3)

πŸ“¦ version 15.1, in freebsd 15.1

πŸ’« STDC_TRAILING_ONES(3) πŸ’«

okay so bestie, this page comes to you straight out of the Library Functions Manual section, and it's about counting the ones that are trailing β€” like, the little gang of 1s chilling at the end of your integer. slay.


🌸 NAME 🌸

stdc_trailing_ones β€” literally just: find the number of trailing ones in an integer. that's the whole vibe. πŸ’…


✨ SYNOPSIS ✨

Standard C Library (libc, -lc) #include <stdbit.h>

unsigned int
stdc_trailing_ones_uc(unsigned char value);

unsigned int
stdc_trailing_ones_us(unsigned short value);

unsigned int
stdc_trailing_ones_ui(unsigned int value);

unsigned int
stdc_trailing_ones_ul(unsigned long value);

unsigned int
stdc_trailing_ones_ull(unsigned long long value);

unsigned int
stdc_trailing_ones(value);

πŸŽ€ DESCRIPTION πŸŽ€

so the stdc_trailing_ones_type() family of functions returns the number of trailing ones in value β€” and value is of type unsigned char, unsigned short, unsigned int, unsigned long, or unsigned long long when type is uc, us, ui, ul, or ull respectively. matching little set, no cap. 🫢

and the stdc_trailing_ones(value) type-generic macro? she's the main character that picks the appropriate stdc_trailing_ones_type() function based on the type of value. iconic behaviour honestly, she just knows. 🌈


πŸ’– RETURN VALUES πŸ’–

returns the number of trailing ones in value.

and if value is all ones β€” like, every single bit is a 1, full send β€” then the total number of bits in the type of value is returned. that's your ceiling, that's the max, periodt. πŸ”₯


πŸ‘‘ SEE ALSO πŸ‘‘

(the whole friend group, go say hi πŸ’œ)


πŸ¦‹ STANDARDS πŸ¦‹

the stdc_trailing_ones_type() family of functions and the stdc_trailing_ones() type-generic macro conform to .

no fr that's genuinely what the page says β€” conform to . with the reference left blank. not me editing the manpage, i promise πŸ™ˆ

⭐ HISTORY ⭐

the stdc_trailing_ones_type() family of functions and the stdc_trailing_ones() type-generic macro were added in FreeBSD 15.1. she's new here but she's already got lore. 🧚


πŸ’œ AUTHOR πŸ’œ

Robert Clausecker <fuz@FreeBSD.org> β€” ty for your service king 🫑


and that's the page!! footer deets so you know where this came from: this is the Debian build, dated November 9, 2025, and the manual page itself is STDC_TRAILING_ONES(3). go count some ones bestie, you're gonna ate πŸ’…βœ¨πŸ“

πŸ“¦ where this page comes from
  • freebsd 15.1: base 15.1
  • πŸ“œ the page's license: BSD-2-Clause
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms