Skip to content

oversized-fixed-width-shift

Default severity: warning

Shifting a fixed-width integer by its full width or more always clears every value bit. This is usually an incorrect shift count. Machine-sized int, uint, and uintptr are excluded because width-dependent bit manipulation can be intentional.

value := uint8(1) << 8
value := uint8(1) << 7