What I find interesting are the trade-offs: machine vs explicit integer wrap-around and buffers with maximum ~size(int)/2 vs ~size(int).
(0 - (2^32 - 1)) % 2^32 = 1