& 0xFF
by itself only ensures that if bytes are longer than 8 bits (allowed by the language standard), the rest are ignored.
And that seems to work fine too?
If the result ends up greater than SHRT_MAX
, you get undefined behavior. In that respect both will work equally poorly.