FFS(9) | Kernel Developer's Manual | FFS(9)

# NAME

`ffs`, `fls`, `flsl` — kernel library find bit routines

# SYNOPSIS

`#include <lib/libkern/libkern.h>`

int
`ffs`(int value);

int
`fls`(int value);

int
`flsl`(long value);

# DESCRIPTION

The `ffs`() function finds the first bit set in value. It has the same semantics as its libc counterpart ffs(3).

The `fls`() and `flsl`() functions find the last bit set in value and return the index of that bit.

# SEE ALSO

ffs(3)

# STANDARDS

The `ffs`() function conforms to IEEE Std 1003.1-2008 (“POSIX.1”).

# HISTORY

The `ffs`() function is based on a vax instruction of the same name.

September 10, 2022 | Debian