Code Room
Code reviewHard
Question
Review this Go helper that returns the absolute value of a 32-bit ADC reading, used to index a histogram.
Readings come from a signed 16.16 fixed-point ADC and are stored as int32, including occasional rail-to-rail values.
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
func absInt32(x int32) int32 { if x < 0 { return -x } return x} func record(hist []uint64, reading int32) { idx := absInt32(reading) hist[idx]++ // hist is sized to the max expected magnitude}Run or narrate your approach, then ask the coach.