Fix build on big endian system

Fixes #11136

(cherry picked from commit 0967877b0a71e15e6682b29171928524deb8bc7e)