word.h(3)
👑 word.h(3) — the manual page, but make it fashion 💅
okay bestie, so this is the page for word.h from the Library Functions Manual — it's a C header that lives in the Bee2 library, and it's all about machine words. lowkey iconic. let's get into it 🦋
✨ NAME ✨
word.h — Машинные слова (machine words, bestie, the little chunks of bits that make the world go round) 🎀
🌸 SYNOPSIS 🌸
#include 'bee2/defs.h'
#include 'bee2/core/u32.h'
🧚 Макросы
here's the whole squad, no cap, every single one:
#define wordEq(a, b)— are the machine wordsaandbequal? 👯#define wordNeq(a, b)— are the machine wordsaandbnot equal? 🙅#define wordLess(a, b)— is machine wordaless than machine wordb?#define wordLeq(a, b)— is machine wordano greater than machine wordb?#define wordGreater(a, b)— is machine wordagreater than machine wordb?#define wordGeq(a, b)— is machine wordano less than machine wordb?#define wordEq01(a, b)— are machine wordsaandbequal (WORD_0/WORD_1)?#define wordNeq01(a, b)— are machine wordsaandbnot equal (WORD_0/WORD_1)?#define wordLess01(a, b)— is machine wordaless than machine wordb(WORD_0/WORD_1)?#define wordLeq01(a, b)— is machine wordano greater than machine wordb(WORD_0/WORD_1)?#define wordGreater01(a, b)— is machine wordagreater than machine wordb(WORD_0/WORD_1)?#define wordGeq01(a, b)— is machine wordano less than machine wordb(WORD_0/WORD_1)?#define wordEq0M(a, b)— are machine wordsaandbequal (WORD_0/WORD_MAX)?#define wordNeq0M(a, b)— are machine wordsaandbnot equal (WORD_0/WORD_MAX)?#define wordLess0M(a, b)— is machine wordaless than machine wordb(WORD_0/WORD_MAX)?#define wordLeq0M(a, b)— is machine wordano greater than machine wordb(WORD_0/WORD_MAX)?#define wordGreater0M(a, b)— is machine wordagreater than machine wordb(WORD_0/WORD_MAX)?#define wordGeq0M(a, b)— is machine wordano less than machine wordb(WORD_0/WORD_MAX)?
💖 Подробное описание 💖
so basically? fast manipulations with machine words are implemented here. that's the whole vibe. ✨
Прим. manipulations with arrays of machine words are implemented in the ww module — different page, bestie, go look there 🫶
the comparison macros were introduced to support (and to highlight) the regular, i.e. branchless, character of the comparisons. on known hardware platforms the ordinary comparisons a < b, a > b, a == b, ... are regular. that's why the implemented macros are aliases of those comparisons. periodt. 💅
if the ordinary comparisons still turn out to be non-regular, then you can use the following universal (but slow 😭) macros [1, с. 35]:
#define wordLess(a, b)\
((~(a) & (b) | ((~(a) | (b)) & (a) - (b))) >> (B_PER_W - 1))
#define wordLeq(a, b)\
(((~(a) | (b)) & (((a) ^ (b)) | ~((b) - (a)))) >> (B_PER_W - 1))
...
the comparison macros without the 01 and 0M suffixes return a result of type int.
the macros with the 01 suffix return a result of type word, which takes the values 0 (WORD_0) or 1 (WORD_1). these macros are handy to use in bignum arithmetic 🔥 (original says "арифметике больших чсел" — yes, that's a typo in the source, and we're keeping it exactly as-is, no editing, that's the rule bestie 🙈).
the macros with the 0M suffix swap WORD_1 for WORD_MAX. the returned values can be used as masks when organizing regular computations. 👑
[1] Уоррен Генри Мл. Алгоритмические трюки для программистов, М.: Издательский дом <<Вильямс>>, 2003.
🎀 Автор 🎀
Автоматически создано Doxygen для Библиотека Bee2 из исходного текста. (auto-generated by Doxygen, bestie — not a human, just a robot doing its little robot thing 🤖✨)
aaaand that's the whole page!! this came from the Библиотека Bee2 (that's the source and version, mwah 💋) and the date stamp on it is Вс 25 Янв 2026 00:00:00 — yeah, Sunday, January 25, 2026, at midnight exactly, main character timing fr fr 🌈⭐
bye bestie, go compare some machine words, you got this 🦋💜
📦 where this page comes from
- fedora 44: bee2-devel 2.2.0-1.fc44 · GPL-3.0-only and GPL-3.0-or-later
- fedora 44: bee2-devel 2.2.0-1.fc44 · GPL-3.0-only and GPL-3.0-or-later
- 💖 girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms