core: Provide functions for different byte orders

Rationale: see #1586.
tests: Add unittests for byteorder.h
tests: fix bad copy+paste in tests-core.h
Merge pull request #1699 from Kijewski/issue-1586

core: Provide functions for different byte orders