neovim/neovim — pull request #571 by philix (2014-04-19 16:51:20+00:00)
Title: [RFC] Use /2 and 2* instead of >>1 and <<1 which are tricky with signed types

Today's compilers generate shift instructions to perform division and
multiplications by powers of 2 [1]. `(x >> 1)` looks straightforward enough, but
if x is signed the code will fail when x < 0. The compiler knows better: use
`x / 2`.

That's why we have code like this:

(long)((long_u)Rows >> 1))

instead of the cleaner version that generates the same or better machine code:

Rows / 2

[1] http://goo.gl/J4WpG7