Re: [PATCH 3/4] shallow.c: bit manipulation tweaks

2016-12-02 Thread Jeff King
On Fri, Dec 02, 2016 at 09:31:03PM +0100, Rasmus Villemoes wrote: > First of all, 1 << 31 is technically undefined behaviour, so let's just > use an unsigned literal. It took me a second to realize that you weren't talking about the unsigned parameter here. You mean using "1U". It might be worth

[PATCH 3/4] shallow.c: bit manipulation tweaks

2016-12-02 Thread Rasmus Villemoes
First of all, 1 << 31 is technically undefined behaviour, so let's just use an unsigned literal. If i is 'signed int' and gcc doesn't know that i is positive, gcc generates code to compute the C99-mandated values of "i / 32" and "i % 32", which is a lot more complicated than simple a simple