Q_FRAWMASK(3)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

πŸ’… 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 for q's fractional data bits. it's literally the mask, bestie. that's the whole vibe. 🎭
  • Q_GFRAW(q) β€” returns q's raw masked fractional data bits. raw. masked. iconic. 🫢
  • Q_GFABSVAL(q) and Q_GFVAL(q) β€” these two return the absolute and real values of q's fractional data bits respectively. lowkey the same family, highkey different jobs πŸ’«
  • Q_SFVAL(q, fv) β€” sets q's fractional data bits to the value fv. 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() and Q_GFVAL() return their respective values as integers of the same underlying ITYPE as q. same energy, same type, fr fr 🧚
  • Q_SFVAL() returns the value of q post set. like, after the glow-up πŸ’–

πŸŽ€ SEE ALSO πŸŽ€

errno(2), qmath(3), stdint(7)

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