u64.h(3)

📦
version 2.2.0 · 2 versions
, in fedora 44

✨ NAME ✨

okay so bestie, this is u64.h, from the Library Functions Manual — the whole page is about 64-битные слова, aka 64-bit words. Sixty-four bits. One word. Iconic. 💅


🦋 SYNOPSIS 🦋

slap these two includes up top and you're literally in:

#include 'bee2/defs.h'
#include 'bee2/core/safe.h'

🎀 Макросы (Macros) 🎀

  • #define u64RotHi(w, d) — circular shift of a u64 word by d positions toward the higher digits ✨
  • #define u64RotLo(w, d) — circular shift of a u64 word by d positions toward the lower digits 🌈

🌸 Функции (Functions) 🌸

  • u64 u64Rev (register u64 w) — octet reverse of a word
  • void u64Rev2 (u64 buf[], size_t count) — octet reverse of an array of words
  • u64 u64Bitrev (register u64 w) — bit reverse
  • size_t u64Weight (register u64 w) — weight
  • bool_t u64Parity (register u64 w) — parity
  • size_t u64CTZ (register u64 w) — number of trailing zero bits
  • size_t u64CLZ (register u64 w) — number of leading zero bits
  • u64 u64Shuffle (register u64 w) — bit shuffle
  • u64 u64Deshuffle (register u64 w) — inverse bit shuffle
  • u64 u64NegInv (register u64 w) — additive-multiplicative inversion
  • void u64From (u64 dest[], const void *src, size_t count) — load from a memory buffer
  • void u64To (void *dest, size_t count, const u64 src[]) — store into a memory buffer

💖 Подробное описание (Detailed description) 💖

The vibe here is simple: operations over 64-bit words and over arrays of such words are implemented. That's the whole thing. 👑

Предусловие (precondition): only correct memory buffers get passed into the functions. Correct buffers only, bestie. We do not play with bogus pointers in this house. 🚫🧚

🎀 Макросы (Macros) 🎀

#define u64RotHi( w, d)

Макроопределение (the macro body), character for character:

((u64)((w) << (d) | (w) >> (64 - (d))))
Предусловие: 0 < d < 64. Do not test her. 😭

#define u64RotLo( w, d)

Макроопределение:

((u64)((w) >> (d) | (w) << (64 - (d))))
Предусловие: 0 < d < 64.

🌈 Функции (Functions) 🌈

u64 u64Bitrev (register u64 w)

The bits of the u64 word w get reversed. Flip it, reverse it, serve it. 🦋

Возвращает (returns): the word with its bits rearranged.

Аргументы (arguments):

  • w — word

size_t FAST u64CLZ (register u64 w)

The length of the run of zero leading bits of the machine word w gets determined.

Возвращает: the length of the run.

Прим. (note): CLZ == Count of Leading Zeros 💡

Регулярность (regularity): a faster irregular edition exists. ✨

Аргументы:

  • w — word

Перекрестные ссылки (cross references): u64CLZ().

Используется в (used in): u64CLZ().

size_t FAST u64CTZ (register u64 w)

The length of the run of zero trailing bits of the u64 word w gets determined.

Возвращает: the length of the run.

Прим.: CTZ == Count of Trailing Zeros 💡

Регулярность: a faster irregular edition exists. ✨

Аргументы:

  • w — word

Перекрестные ссылки: u64CTZ().

Используется в: u64CTZ().

u64 u64Deshuffle (register u64 w)

The even bits of the u64 word w get grouped into its lower half, the odd ones — into the upper half.

Возвращает: the word with grouped bits.

Аргументы:

  • w — word

void u64From (u64 dest[], const void * src, size_t count)

The buffer [count]src gets converted into an array [(count + 7) / 8]dest of u64 words.

Аргументы:

  • dest — receiver
  • src — source
  • count — number of octets

u64 u64NegInv (register u64 w)

Additive and multiplicative inversion of the u64 word-as-a-number w modulo 2^64 gets performed.

Предусловие: w is odd. Odd only. Нечётное, fr fr. 🫶

Возвращает: - w^{-1} \mod 2^64.

Прим.: the computed word is used in Montgomery reduction. 🔥

Аргументы:

  • w — word

bool_t u64Parity (register u64 w)

The sum modulo 2 of the bits of the u64 word w gets determined.

Возвращает: the sum of the bits.

Аргументы:

  • w — word

u64 u64Rev (register u64 w)

The octets of the u64 word w get reversed.

Возвращает: the word with its octets rearranged.

Аргументы:

  • w — word

void u64Rev2 (u64 buf[], size_t count)

The octets of the array [count]buf of u64 words get reversed.

Аргументы:

  • buf — array of words
  • count — number of elements

u64 u64Shuffle (register u64 w)

The bits of the lower half of the u64 word w move into the even positions, the bits of the upper half — into the odd ones.

Возвращает: the word with shuffled bits.

Аргументы:

  • w — word

void u64To (void * dest, size_t count, const u64 src[])

The buffer [count]dest gets formed from the array [(count + 7) / 8]src of u64 words.

Аргументы:

  • dest — receiver
  • count — number of octets
  • src — source

size_t u64Weight (register u64 w)

The number of nonzero bits in the u64 word w gets determined.

Возвращает: the number of nonzero bits.

Аргументы:

  • w — word

👑 Автор (Author) 👑

Automatically generated by Doxygen for the Библиотека Bee2 from source text. A robot wrote this and honestly? It ate. 🤖✨


so yeah, that's the whole page — brought to you by Библиотека Bee2 💖 dated Вс 25 Янв 2026 00:00:00, and the manual page itself is u64.h(3). Go forth and shift those bits, bestie. Periodt. 💅🎀

📦 where this page comes from