I am porting firmware from C in which a uint8_t sequence number simply rolls over from 255 to 0, and a 16-bit timer value is subtracted to get elapsed ticks. In Zig, seq += 1; on a u8 holding 255 stops the Debug build with a panic about integer overflow, and the same happens with now - start when the timer has wrapped.
Why is this an error for unsigned types when C defines it, what happens in release builds, and what is the correct way to write arithmetic that is supposed to wrap?




