byte_diff(3)

πŸ“¦
version 0.34 Β· 2 versions
  • 0.34 Β· alpine 3.24, debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 0.30 Β· fedora 43, fedora 44, ubuntu jammy
, in alpine 3.24, debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ byte_diff(3) ✨

okay so bestie, welcome to the byte_diff page from the Library Functions Manual β€” it's a tiny one but it's iconic, and I need you to know it exists. 🫢


πŸ’– NAME πŸ’–

byte_diff β€” compare two strings

no fr, that's the whole job. it compares. that's her main character energy. πŸ‘‘


🌸 SYNTAX 🌸

#include <libowfat/byte.h>

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

so you gotta pull in libowfat/byte.h first, then you're free to call her. the signature is literally that. one is a const char *, len is a size_t, two is a const char *, and she hands you back an int. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

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]. ⭐

and yes bestie, the manpage really does say one in both spots β€” I'm quoting her exactly, that's her words, not mine πŸ™ˆ iykyk

and here's the part that's lowkey the most slay: when the strings are different, byte_diff does not read bytes past the first difference. she stops the second she knows. efficiency queen. no unnecessary scrolling. periodt. πŸ’€βœ¨


πŸŽ€ SEE ALSO πŸŽ€

like obviously go read her sister page too, they're a matching set. 🧚


and that's the whole page, bestie!! 🌈 this one came straight off the byte_diff(3) page in the Library Functions Manual β€” that's the title and the footer, she's her own little bookend, no version number, no date, just vibes. go compare some bytes responsibly. πŸ“πŸ’œ