bitmanipulation: fix undefined behavior in bit shift in getbe32
OSS-Fuzz caught this in its ubsan mode. I'm not worried about a
security issue here because in practice this should work out the way
we naively expected, we're just making things explicit to the
compiler with the casts.
Differential Revision: https://phab.mercurial-scm.org/D3729