> For the complete documentation index, see [llms.txt](https://book.bsdcn.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.bsdcn.org/man/stdbit/stdc_first_trailing_zero.3.md).

# stdc\_first\_trailing\_zero.3

`stdc_first_trailing_zero` — 查找整数中首个尾随 0

## 名称

`stdc_first_trailing_zero`

## 概要

`Lb libc`

```c
#include <stdbit.h>
```

```c
unsigned int stdc_first_trailing_zero_uc(unsigned char value);
unsigned int stdc_first_trailing_zero_us(unsigned short value);
unsigned int stdc_first_trailing_zero_ui(unsigned int value);
unsigned int stdc_first_trailing_zero_ul(unsigned long value);
unsigned int stdc_first_trailing_zero_ull(unsigned long long value);
unsigned int stdc_first_trailing_zero(value);
```

## 描述

`stdc_first_trailing_zero_`*type*() 函数族返回 `value` 中最低有效清 0 位的索引，其中 `value` 的类型分别为 `unsigned char`、`unsigned short`、`unsigned int`、`unsigned long` 或 `unsigned long long`，对应 *type* 为 **uc**、**us**、**ui**、**ul** 或 **ull**。类型通用宏 `stdc_first_trailing_zero`(*value*) 根据 `value` 的类型选择适当的 `stdc_first_trailing_zero_`*type*() 函数。

## 返回值

返回 `value` 中最低有效清 0 位的索引。位的编号方式为：最低有效位编号为 1，最高有效位编号为 w，其中 w 是 `value` 类型的位数。如果 `value` 中没有清 0 的位（即 `value` 是零的按位取反），则返回 0。

## 参见

bit\_ffc(3), [stdbit(3)](https://github.com/FreeBSD-Ask/freebsd-man-sc/tree/main/stdbit/stdbit.3.md), [stdc\_trailing\_ones(3)](/man/stdbit/stdc_trailing_ones.3.md), stdc\_first\_trailing\_ones(3), [stdc\_first\_leading\_zero(3)](/man/stdbit/stdc_first_leading_zero.3.md)

## 标准

`stdc_first_trailing_zero_`*type*() 函数族和 `stdc_first_trailing_zero` 类型通用宏遵循 -isoC-2023 标准。

## 历史

`stdc_first_trailing_zero_`*type*() 函数族和 `stdc_first_trailing_zero` 类型通用宏在 FreeBSD 15.1 中添加。

## 作者

Robert Clausecker <fuz@FreeBSD.org>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://book.bsdcn.org/man/stdbit/stdc_first_trailing_zero.3.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
