Uses built-in byte swap if available (Apple) and if bswap_XX
is undefined.
Defers to pre-defined version if found (e.g. protobuf). For protobuf case, the definitions are identical and thus include order should not affect results.
Fixes compilation errors on recent Mac OS X with QT client enabled.