qlibs(byte)

πŸ“¦ version 31, in alpine 3.24

byte β€” byte manipulation/evaluation πŸ’…βœ¨

Okay so welcome to the qlibs(byte) manual, bestie β€” this is the one about byte manipulation/evaluation, and it's lowkey iconic. I'm giving you the whole thing, no cap, every detail intact. 🫢


✨ NAME ✨

byte - byte manipulation/evaluation

πŸŽ€ SYNTAX πŸŽ€

This is the exact include and the function signatures, so copy-paste energy:

#include "byte.h"

unsigned int byte_chr(const char *haystack,unsigned int len,char
needle);
unsigned int byte_rchr(const char *haystack,unsigned int len,char
needle);

void byte_copy(char *out,unsigned int len,const char *in);
void byte_copyr(char *out,unsigned int len,const char *in);

int byte_diff(const char *one,unsigned int len,const char *two);

int byte_equal(const char *one,unsigned int len,const char *two);

void byte_fill(char *out,unsigned int len,const char c);
void byte_zero(char *out,unsigned int len);

Yes, those line breaks are exactly how they show up on the page β€” I'm not messing with your signatures. πŸ’…

πŸ’– DESCRIPTION πŸ’–

Now the actual tea. β˜•

  • byte_chr returns the smallest integer i between 0 and len-1 inclusive such that one[i] equals needle. If no such integer exists, byte_chr returns len. And heads up: byte_chr may read all bytes one[0], one[1], ..., one[len-1], even if not all the bytes are relevant to the answer. πŸ‘€
  • byte_rchr returns the largest integer i between 0 and len-1 inclusive such that one[i] equals needle. If no such integer exists, byte_rchr returns len. It may also read all bytes one[0], one[1], ..., one[len-1], even if not all the bytes are relevant to the answer. πŸ’…
  • byte_copy copies in[0] to out[0], in[1] to out[1], etc., and finally in[len-1] to out[len-1]. Slay, straightforward. ✨
  • byte_copyr copies in[len-1] to out[len-1], in[len-2] to out[len-2], etc., and in[0] to out[0]. Reverse-order bestie. πŸ¦‹
  • byte_diff returns negative, 0, or positive, depending on whether the string one[0], one[1], ..., one[len-1] is lexicographically smaller than, equal to, or greater than the string one[0], one[1], ..., one[len-1]. When the strings are different, byte_diff does not read bytes past the first difference. And yes, the page literally says one both times in that comparison β€” I'm not fixing it, I'm delivering it exactly, periodt. πŸ’€
  • byte_equal returns 1 if the strings are equal, 0 otherwise. When the strings are different, byte_equal does not read bytes past the first difference. πŸŽ€
  • byte_fill fills out[0], out[1], ..., out[len-1] with a single byte c. πŸ’–
  • byte_zero sets out[0], out[1], ..., out[len-1] to 0. Zero-out era. 🌸

🌈 SEE ALSO 🌈

Go give these a little look when you're done, bestie:

That's the whole SEE ALSO list β€” no extras, no cap. 🫢


Final cute little sign-off: this is page 3 of the qlibs(byte) manual β€” that's the footer energy, and the page doesn't list a date, so I'm not inventing one. πŸ’…βœ¨

πŸ“¦ where this page comes from