Compute Parity of Word
Compute the even parity bit of a 32-bit word - 1 if the word contains an odd number of set bits, 0 otherwise. Used to append a parity bit to a memory word or serial frame.
Constraints
- Signature: `int parity32(uint32_t value)`.
- Must not loop 32 times.
- No __builtin_parity.
- No lookup tables.
- Must return 0 for input 0.
1#include <stdint.h>2 3int parity32(uint32_t value) {4 // TODO5 return 0;6}