ZT_CMP_UINT(3)

πŸ’– ZT_CMP_UINT(3) β€” the "is this number bigger than that number" claim girlies πŸ’–

okay so bestie, we're in the libzt section of the manual (that's the LOCAL one, iykyk) and today's main character is ZT_CMP_UINT / zt_cmp_uint. she builds claims. about unsigned integers. it's giving ✨math✨ but make it a data structure.


🌸 NAME 🌸

ZT_CMP_UINT, zt_cmp_uint β€” construct a claim of a relation between two unsigned integers

like literally that's her whole job. no cap. 🫢


✨ SYNOPSIS ✨

#include <zt.h>

#define ZT_CMP_UINT(left, rel, right) \
  zt_cmp_uint( \
    ZT_CURRENT_LOCATION(), \
    zt_pack_unsigned((left), (#left)), \
    zt_pack_string((#rel), (#rel)), \
    zt_pack_unsigned((right), (#right)))

zt_claim
zt_cmp_uint(zt_location location, zt_value left, zt_value rel,
    zt_value right);

πŸ’… DESCRIPTION πŸ’…

so zt_cmp_uint() constructs a claim of a relation between two unsigned integers. that's it, that's the vibe.

but listen β€” you should be using her through the macro ZT_CMP_UINT(), okay? not raw-dogging the function directly. the macro is the one that passes the source code location and does all the packing for you. she's the responsible older sister fr fr. πŸŽ€

and the relation? it must be one of exactly these:

  • ==
  • !=
  • <
  • <=
  • >
  • >=

that's the whole list bestie, don't try to get creative with it, she will not be accepting new applicants. πŸ’€


🧚 IMPLEMENTATION NOTES 🧚

good news for everyone who's ever been burned by a macro evaluating their argument seventeen times: ZT_CMP_UINT() evaluates left and right exactly once. once!! slay. one (1) time. iconic behaviour honestly. πŸ‘‘


🌈 RETURN VALUES 🌈

both the macro and the function return a claim structure with the right attributes set. like she did the work, she set the attributes, she's ready.

and then? you usually hand that claim off to zt_check() or to zt_assert(). passing the baton. main character to main character. 🀝


πŸ¦‹ SEE ALSO πŸ¦‹

(yes she's listed in her own SEE ALSO. self-love. we stan. πŸ’–)


πŸ“œ HISTORY πŸ“œ

the ZT_CMP_UINT() macro and the zt_cmp_uint() function first appeared in libzt 0.1. baby's first release, crying, so proud. 😭

then, since libzt 0.3, zt_cmp_uint() internally promotes the left and right arguments from ZT_UNSIGNED to ZT_UINTMAX. glow up arc complete. the range got bigger and so did her confidence. πŸ”₯


πŸ‘‘ AUTHORS πŸ‘‘

Zygmunt Krynicki <me@zygoon.pl> β€” the actual legend who wrote all this. we love him, we thank him, no notes. 🫢


and that's the whole page bestie!! this was libzt 0.3.1, dated January 12, 2020, and you just read ZT_CMP_UINT(3) β€” the LOCAL section's finest. go compare some unsigned integers responsibly. mwah. πŸ’‹βœ¨πŸŽ€