(trunk libT) add attribution for the fallback tr_htonll() and tr_ntohll() code

This commit is contained in:
Jordan Lee 2011-03-13 20:39:08 +00:00
parent 58c084fbda
commit 4fc6c1ada2
1 changed files with 4 additions and 0 deletions

View File

@ -1658,6 +1658,8 @@ tr_htonll( uint64_t x )
#ifdef HAVE_HTONLL
return htonll( x );
#else
/* fallback code by Runner and Juan Carlos Cobas at
* http://www.codeproject.com/KB/cpp/endianness.aspx */
return (((uint64_t)(htonl((int)((x << 32) >> 32))) << 32) |
(unsigned int)htonl(((int)(x >> 32))));
#endif
@ -1669,6 +1671,8 @@ tr_ntohll( uint64_t x )
#ifdef HAVE_NTOHLL
return ntohll( x );
#else
/* fallback code by Runner and Juan Carlos Cobas at
* http://www.codeproject.com/KB/cpp/endianness.aspx */
return (((uint64_t)(ntohl((int)((x << 32) >> 32))) << 32) |
(unsigned int)ntohl(((int)(x >> 32))));
#endif