Q_IFRAWMASK(3)
okay bestie, welcome to Q_IFRAWMASK(3) from the Library Functions Manual β the fixed-point math page thatβs lowkey iconic and highkey here to explain the combined integer/fractional data bits situation. π
β¨
β¨ NAME β¨
The whole squad: Q_IFRAWMASK, Q_IFVALIMASK, Q_IFVALFMASK, Q_GIFRAW, Q_GIFABSVAL, Q_GIFVAL, Q_SIFVAL, Q_SIFVALS β fixed-point math functions which manipulate the combined integer/fractional data bits. π«Ά
π οΈ SYNOPSIS π οΈ
#include <sys/qmath.h>
ITYPE
Q_IFRAWMASK(QTYPE q);
ITYPE
Q_IFVALIMASK(QTYPE q);
ITYPE
Q_IFVALFMASK(QTYPE q);
ITYPE
Q_GIFRAW(QTYPE q);
ITYPE
Q_GIFABSVAL(QTYPE q);
ITYPE
Q_GIFVAL(QTYPE q);
QTYPE
Q_SIFVAL(QTYPE q, ITYPE ifv);
QTYPE
Q_SIFVALS(QTYPE q, ITYPE iv, ITYPE fv);
π DESCRIPTION π
Q_IFRAWMASK()β returns a q-specific bit mask forqβs combined integer and fractional data bits. πQ_IFVALIMASK()andQ_IFVALFMASK()β return q-specific bit masks for the integer and fractional bits ofqβs combined integer and fractional data bits value, i.e., are applicable to the values returned byQ_GIFABSVAL()andQ_GIFVAL(). π¦Q_GIFRAW()β returnsqβs raw masked integer/fractional data bits. β¨Q_GIFABSVAL()andQ_GIFVAL()β return the absolute and real values ofqβs integer/fractional data bits respectively. π«Q_SIFVAL()β setsqβs combined integer/fractional data bits to the valueifv, whereasQ_SIFVALS()independently setsqβs integer and fractional data bits to the separate valuesivandfv. π₯
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 π
Okay so the return-value roster is literally Q_IFRAWMASK(), Q_IFVALIMASK(), Q_IFVALFMASK(), Q_GIFABSVAL(), Q_GIFVAL(), Q_GIFRAW(), Q_GIFABSVAL() and Q_GIFVAL() β yes, Q_GIFABSVAL() and Q_GIFVAL() are in there twice, and they return their respective values as integers of the same underlying ITYPE as q. π No cap, thatβs the list.
Q_SIFVAL() and Q_SIFVALS() return the value of q post change. Slay. π
π SEE ALSO π
πΈ 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 <lstewart@FreeBSD.org> and sponsored by Netflix, Inc. π«Ά
π source/version: Debian β’ date: July 8, 2018 β’ manual: Q_IFRAWMASK(3) β bye bestie, go make those bits behave! π§ββοΈπ
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2018 Netflix, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms