Expand codec bitfield from 32 bits to 64 bits.

Reviewboard: https://reviewboard.asterisk.org/r/416/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@227580 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Tilghman Lesher
2009-11-04 14:05:12 +00:00
parent 6a50e7a031
commit d8e0c58437
124 changed files with 1777 additions and 1366 deletions

View File

@@ -334,3 +334,55 @@ int getloadavg(double *list, int nelem)
#endif /* linux */
#endif /* !HAVE_GETLOADAVG */
#ifndef HAVE_NTOHLL
uint64_t ntohll(uint64_t net64)
{
#if BYTE_ORDER == BIG_ENDIAN
return net64;
#elif BYTE_ORDER == LITTLE_ENDIAN
union {
unsigned char c[8];
uint64_t u;
} number;
number.u = net64;
return
(((uint64_t) number.c[0]) << 0) |
(((uint64_t) number.c[1]) << 8) |
(((uint64_t) number.c[2]) << 16) |
(((uint64_t) number.c[3]) << 24) |
(((uint64_t) number.c[4]) << 32) |
(((uint64_t) number.c[5]) << 40) |
(((uint64_t) number.c[6]) << 48) |
(((uint64_t) number.c[7]) << 56);
#else
#error "Unknown byte order"
#endif
}
#endif
#ifndef HAVE_HTONLL
uint64_t htonll(uint64_t host64)
{
#if BYTE_ORDER == BIG_ENDIAN
return host64;
#elif BYTE_ORDER == LITTLE_ENDIAN
union {
unsigned char c[8];
uint64_t u;
} number;
number.u = host64;
return
(((uint64_t) number.c[0]) << 0) |
(((uint64_t) number.c[1]) << 8) |
(((uint64_t) number.c[2]) << 16) |
(((uint64_t) number.c[3]) << 24) |
(((uint64_t) number.c[4]) << 32) |
(((uint64_t) number.c[5]) << 40) |
(((uint64_t) number.c[6]) << 48) |
(((uint64_t) number.c[7]) << 56);
#else
#error "Unknown byte order"
#endif
}
#endif