Is there any "standard" htonl-like function for 64 bits integers in C++ ?
- by ereOn
Hi,
I'm working on an implementation of the memcache protocol which, at some points, uses 64 bits integer values. These values must be stored in "network byte order".
I wish there was some uint64_t htonll(uint64_t value) function to do the change, but unfortunately, if it exist, I couldn't find it.
So I have 1 or 2 questions:
Is there any portable (Windows, Linux, AIX) standard function to do this ?
If there is no such function, how would you implement it ?
I have in mind a basic implementation but I don't know how to check the endianness at compile-time to make the code portable. So your help is more than welcome here ;)
Thank you.