code: Provide functions for different byte orders

Rationale: see #1586.

Closes #1586.