code: Provide functions for different byte orders

Rationale: see #1586.