---
name: "Q_GCVAL"
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/Q_CRAWMASK"
---

# Q\_GCVAL(3)

fixed-point math functions which manipulate the control/sign data bits

Part of [Q\_CRAWMASK(3)](/Q_CRAWMASK/3.md).

## NAME

**Q\_SIGNSHFT**, **Q\_SSIGN**, **Q\_CRAWMASK**, **Q\_SRAWMASK**, **Q\_GCRAW**, **Q\_GCVAL**, **Q\_SCVAL** – fixed-point math functions which manipulate the control/sign data bits

## SYNOPSIS

**#include \<sys/qmath.h\>**

*uint32\_t*\

**Q\_SIGNSHFT**(*QTYPE q*);

*QTYPE*\

**Q\_SSIGN**(*QTYPE q*, *bool isneg*);

*ITYPE*\

**Q\_CRAWMASK**(*QTYPE q*);

*ITYPE*\

**Q\_SRAWMASK**(*QTYPE q*);

*ITYPE*\

**Q\_GCRAW**(*QTYPE q*);

*ITYPE*\

**Q\_GCVAL**(*QTYPE q*);

*QTYPE*\

**Q\_SCVAL**(*QTYPE q*, *ITYPE cv*);

## DESCRIPTION

**Q\_SIGNSHFT**() gets the bit position of *q*'s sign bit relative to bit zero.

**Q\_SSIGN**() sets the sign bit of *q* based on the boolean *isneg*.

**Q\_CRAWMASK**() and **Q\_SRAWMASK**() return *q*-specific bit masks for *q*'s control bits and sign bit respectively.

**Q\_GCRAW**() and **Q\_GCVAL**() get the raw masked control bits and value of *q*'s control bits respectively.

**Q\_SCVAL**() sets *q*'s control bits to the value *cv*.

All of those functions operate on the following data types: *s8q\_t*, *u8q\_t*, *s16q\_t*, *u16q\_t*, *s32q\_t*, *u32q\_t*, *s64q\_t*, and *u64q\_t*, which are referred to generically as *QTYPE*. The *ITYPE* refers to the [stdint(7)](/stdint/7.md) integer types.

For more details, see [qmath(3)](/qmath/3.md).

## RETURN VALUES

**Q\_SIGNSHFT**() returns the sign bit's position as an integer.

**Q\_SSIGN**() returns the value of *q* post change.

**Q\_CRAWMASK**(), **Q\_SRAWMASK**(), **Q\_GCRAW**() and **Q\_GCVAL**() return their respective values as integers of the same underlying ITYPE as *q*.

**Q\_SCVAL**() returns the value of *q* post change.

## SEE ALSO

[errno(2)](/errno/2.md), [qmath(3)](/qmath/3.md), [stdint(7)](/stdint/7.md)

## HISTORY

The [qmath(3)](/qmath/3.md) functions first appeared in FreeBSD 13.0.

## AUTHORS

The [qmath(3)](/qmath/3.md) functions and this manual page were written by Lawrence Stewart ⟨*lstewart@FreeBSD.org*⟩ and sponsored by Netflix, Inc.
