Q_GCVAL(3)

Q_GCVAL3

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

Part of Q_SIGNSHFT(3).

Usage

#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);

Overview

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) integer types.

For more details, see qmath(3).

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.

Releases

15 releases since FreeBSD 13.0-RELEASE; the text changed 1 time.

  1. 13.0–13.2
  2. 13.3–16.0

History

The qmath(3) functions first appeared in FreeBSD 13.0.

Authors

The qmath(3) functions and this manual page were written by Lawrence Stewart ⟨[email protected]⟩ and sponsored by Netflix, Inc.

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.