mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
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:
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user