core: Provide functions for different byte orders

Rationale: see #1586.

I have no problem with
```c
typedef union __attribute__((packed)) {
    …
} …;
```
will change.