ZT_PACK_INTEGER(3)

πŸ’– zt_pack_integer β€” bestie's guide to packing ints πŸ’–

okay so. this is a page from the LOCAL manual set, and it's all about zt_pack_integer(3). yes bestie, the one that packs an integer into a variant. let's get into it 🫢


✨ NAME ✨

zt_pack_integer β€” pack an integer into a variant πŸ’…


🌸 SYNOPSIS 🌸

#include <zt.h>

zt_value
zt_pack_integer(intmax_t value, const char *source);

like. that's it. that's the whole vibe. two args and a zt_value coming right back at you πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea. zt_pack_integer takes an integer β€” and also the string that describes the expression that got evaluated to produce it β€” and packs both of them into a variant-like zt_value. two for one, iconic behaviour, no notes πŸ’–

the source argument is retained by the value, which is lowkey important. it's typically a constant string literal produced by the preprocessor. so like, the value remembers where it came from. main character energy fr fr ✨


πŸ”₯ IMPLEMENTATION NOTES πŸ”₯

zt_pack_integer is only provided as a static inline function. that's the whole note. it's not out here living in some object file, it's just vibing inline. iykyk πŸ’€


πŸ’œ RETURN VALUES πŸ’œ

the packed value. that's the return. slay 🌈


πŸ‘‘ SEE ALSO πŸ‘‘

(yes zt_pack_integer(3) is in there twice. and a comma situation. we're keeping it exactly as written, bestie β€” no cap, i do not edit the source material 🫢)


🌈 HISTORY 🌈

zt_pack_integer first appeared in libzt 0.1. baby's first debut πŸŽ€

then in libzt 0.3 the type of the first argument changed to intmax_t, to accommodate for wider values. glow-up era ✨ the resulting value structure encodes the new corresponding kind, ZT_INTMAX.

note that zt_value objects created by programs compiled with earlier versions of libzt are still valid and are internally promoted to the wider type. so your old stuff still works?? we love backwards compatibility in this house πŸ’–

πŸ“ AUTHORS πŸ“

Zygmunt Krynicki <me@zygoon.pl> β€” the legend themselves πŸ‘‘


and that's the whole page!! this was libzt 0.3.1, dated January 12, 2020 β€” shoutout to the LOCAL manual section for having us, mwah πŸ’…πŸ’–βœ¨