mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-06-14 20:31:52 +00:00
lib: make htonll/ntohll compile time and readable
Make the htonll/ntohll functions compile time determined since we have MACROS to determine endianess and bonus points it makes it more readable. Signed-off-by: Stephen Worley <sworley@nvidia.com>
This commit is contained in:
parent
d3909a2114
commit
ee720c5dca
15
lib/zebra.h
15
lib/zebra.h
@ -338,14 +338,13 @@ struct in_pktinfo {
|
|||||||
|
|
||||||
#define strmatch(a,b) (!strcmp((a), (b)))
|
#define strmatch(a,b) (!strcmp((a), (b)))
|
||||||
|
|
||||||
#define htonll(x) \
|
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||||
((1 == htonl(1)) \
|
#define htonll(x) (((uint64_t)htonl((x)&0xFFFFFFFF) << 32) | htonl((x) >> 32))
|
||||||
? (x) \
|
#define ntohll(x) (((uint64_t)ntohl((x)&0xFFFFFFFF) << 32) | ntohl((x) >> 32))
|
||||||
: ((uint64_t)htonl((x)&0xFFFFFFFF) << 32) | htonl((x) >> 32))
|
#else
|
||||||
#define ntohll(x) \
|
#define htonll(x) (x)
|
||||||
((1 == ntohl(1)) \
|
#define ntohll(x) (x)
|
||||||
? (x) \
|
#endif
|
||||||
: ((uint64_t)ntohl((x)&0xFFFFFFFF) << 32) | ntohl((x) >> 32))
|
|
||||||
|
|
||||||
#ifndef INADDR_LOOPBACK
|
#ifndef INADDR_LOOPBACK
|
||||||
#define INADDR_LOOPBACK 0x7f000001 /* Internet address 127.0.0.1. */
|
#define INADDR_LOOPBACK 0x7f000001 /* Internet address 127.0.0.1. */
|
||||||
|
Loading…
Reference in New Issue
Block a user