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
c++: core: add extern C in header files
Merge pull request #1783 from dangnhat/extern_C_in_headers_core

c++: core: add extern C in header files
Merge pull request #1699 from Kijewski/issue-1586

core: Provide functions for different byte orders