Add inline endian encoding/decoding functions Taken from FreeBSD. Signed-off-by: Guillem Jover <guillem@hadrons.org>