parity8(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ NAME πŸŽ€

parity8 β€” get the parity of an u8 value. This is the parity8(9) page from the Kernel API Manual, hiii bestie πŸ’–

✨ SYNOPSIS ✨

int parity8 (u8 val );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • val β€” the value to be examined πŸ‘€

🌸 DESCRIPTION 🌸

Okay so parity8() determines the parity of the u8 argument. That's the whole vibe: it tells you the parity of that value ✨

πŸ’« RETURN πŸ’«

  • 0 for even parity
  • 1 for odd parity

πŸ”₯ NOTE πŸ”₯

This function informs you about the current parity. Example to bail out when parity is odd:

if (parity8(val) == 1) return -EBADMSG;

If you need to calculate a parity bit, you need to draw the conclusion from this result yourself. Example to enforce odd parity, parity bit is bit 7:

if (parity8(val) == 0) val ^= BIT(7);

🌈 SEE ALSO 🌈

Kernel file ./include/linux/bitops.h, plus these icon functions: rol64(9), ror64(9), rol32(9), ror32(9), rol16(9), ror16(9), rol8(9), ror8(9), sign_extend32(9), sign_extend64(9), get_count_order_long(9), __ffs64(9), fns(9), assign_bit(9), __ptr_set_bit(9), __ptr_clear_bit(9), __ptr_test_bit(9).


kisses and kernel sparkles πŸ’… parity8(9) out β€” source/version ./include/linux, dated October 2026 🫢

πŸ“¦ where this page comes from