unsigned long x, y; x <<= y; always produces a warning because y is casted to int. Handle them instead the same way as regular shifts.