uint16_unpack_big(3)

πŸ“¦
version 0.34 Β· 2 versions
  • 0.34 Β· alpine 3.24, debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 0.30 Β· fedora 43, fedora 44, ubuntu jammy
, in alpine 3.24, debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– uint16_unpack_big β€” bestie edition πŸ’–

okay so real quick, the manual name is Library Functions Manual and the page is uint16_unpack_big(3), and we're about to make big-endian bytes behave. no cap.


✨ NAME ✨

uint16_unpack_big β€” read an unsigned big-endian 16-bit integer 🌸


✨ SYNTAX ✨

like, this is literally what you type, copy it exactly bestie:

#include <libowfat/uint16.h>

uint16 u;

void uint16_unpack_big(const char s[2],uint16 *u);

✨ DESCRIPTION ✨

so uint16 is a 16-bit unsigned integer type β€” it's normally either unsigned int or unsigned long. that's it, that's the type. πŸŽ€

and uint16_unpack_big? okay so the way that it works is: it portably reads a uint16 as stored on a big-endian architecture (i.e. in network byte order) from s, and writes it into u in the native byte order. πŸ¦‹

the whole vibe is "the bytes came in big-endian, but your machine might not be, and we are not about to let that be your problem." it handles the portability for you. iconic. πŸ‘‘

heads up: s is a const char s[2] β€” it points at exactly 2 bytes, and u is a uint16 *, so the result lands wherever that pointer says. πŸ’…

✨ SEE ALSO ✨


okay that's the whole page bestie, you ate, go unpack some bytes πŸ’œ

this was the uint16_unpack_big(3) page out of the Library Functions Manual (that's the source/version vibe, no date on this one, we keep it mysterious πŸ™ˆ) β€” mwah, slay, periodt πŸ’–βœ¨