---
name: "stdc_bit_floor"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/stdc_bit_floor"
---

# stdc\_bit\_floor(3)

round down to the previous power of 2

## NAME

**stdc\_bit\_floor** – round down to the previous power of 2

## SYNOPSIS

Standard C Library (libc, -lc)

**#include \<stdbit.h\>**

*unsigned* *char*\

**stdc\_bit\_floor\_uc**(*unsigned char value*);

*unsigned* *short*\

**stdc\_bit\_floor\_us**(*unsigned short value*);

*unsigned* *int*\

**stdc\_bit\_floor\_ui**(*unsigned int value*);

*unsigned* *long*\

**stdc\_bit\_floor\_ul**(*unsigned long value*);

*unsigned* *long* *long*\

**stdc\_bit\_floor\_ull**(*unsigned long long value*);

*typeof* *Ns* *Pq* *Em* *value*\

**stdc\_bit\_floor**(*value*);

## DESCRIPTION

The **stdc\_bit\_floor\_***type*() family of functions rounds *value* down to the previous power of 2, 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. The **stdc\_bit\_floor**(*value*) type-generic macro picks the appropriate **stdc\_bit\_floor\_***type*() function based on the type of *value*.

## RETURN VALUES

Returns *value* round down to the previous power of 2. If *value* is equal to zero, zero is returned.

## SEE ALSO

[stdbit(3)](/stdbit/3.md), [stdc\_bit\_ceil(3)](/stdc_bit_ceil/3.md)

## STANDARDS

The **stdc\_bit\_floor\_***type*() family of functions and the **stdc\_bit\_floor**() type-generic macro conform to ISO/IEC 9899:2024 (“ISO C23”).

## HISTORY

The **stdc\_bit\_floor\_***type*() family of functions and the **stdc\_bit\_floor**() type-generic macro were added in FreeBSD 15.1.

## AUTHORS

Robert Clausecker ⟨*fuz@FreeBSD.org*⟩
