Q_FRAWMASK(3)
π Q_FRAWMASK(3) β fixed-point math, but make it fractional π
okay so bestie, welcome to the Library Functions Manual page for Q_FRAWMASK(3) β this whole little family of functions is all about messing with the fractional data bits of fixed-point numbers, and honestly? it's giving "small but mighty" β¨
πΈ NAME πΈ
Q_FRAWMASK, Q_GFRAW, Q_GFABSVAL, Q_GFVAL, Q_SFVAL β fixed-point math functions which manipulate the fractional data bits π
π¦ SYNOPSIS π¦
#include <sys/qmath.h>
ITYPE
Q_FRAWMASK(QTYPE q);
ITYPE
Q_GFRAW(QTYPE q);
ITYPE
Q_GFABSVAL(QTYPE q);
ITYPE
Q_GFVAL(QTYPE q);
QTYPE
Q_SFVAL(QTYPE q, ITYPE fv);
π DESCRIPTION π
okay so here's the rundown, one function at a time, no cap π₯
Q_FRAWMASK(q)β returns a q-specific bit mask forq's fractional data bits. it's literally the mask, bestie. that's the whole vibe. πQ_GFRAW(q)β returnsq's raw masked fractional data bits. raw. masked. iconic. π«ΆQ_GFABSVAL(q)andQ_GFVAL(q)β these two return the absolute and real values ofq's fractional data bits respectively. lowkey the same family, highkey different jobs π«Q_SFVAL(q, fv)β setsq's fractional data bits to the valuefv. that's it. that's the function. slay π
now for the β¨ important β¨ part: 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 π
and the ITYPE? that refers to the stdint(7) integer types. periodt.
for more details, see qmath(3) β like, genuinely, go look at it, it's the main character of this whole situation π
β RETURN VALUES β
Q_FRAWMASK(),Q_GFRAW(),Q_GFABSVAL()andQ_GFVAL()return their respective values as integers of the same underlyingITYPEasq. same energy, same type, fr fr π§Q_SFVAL()returns the value ofqpost set. like, after the glow-up π
π SEE ALSO π
go read them, bestie, iykyk πβ¨
π°οΈ HISTORY π°οΈ
The qmath(3) functions first appeared in FreeBSD 13.0. a whole era πβ¨
π AUTHORS π
The qmath(3) functions and this manual page were written by Lawrence Stewart <lstewart@FreeBSD.org> and sponsored by Netflix, Inc. πΏπ¬
ngl the fractional bits are where the drama lives, so handle them with love π
and that's the whole page! this cutie dropped on Debian, July 8, 2018 β mwah, bye bestie π«Άπ
π¦ 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