diff options
| author | Stephen Worley <sworley@nvidia.com> | 2021-04-01 11:22:40 -0400 |
|---|---|---|
| committer | Stephen Worley <sworley@nvidia.com> | 2023-02-13 18:12:04 -0500 |
| commit | 04cb115d97a4bd43b008ef8d954e88eb725ad3a1 (patch) | |
| tree | bc9ab1dfd9012761de7c398993b3ec23aefc8a1c /lib/zebra.h | |
| parent | 1ca713b375655f12130491443898c32acee1c0fb (diff) | |
lib: add 64bit versions of htonl/ntohl
Add 64bit version of htonl/ntohl.
Signed-off-by: Stephen Worley <sworley@nvidia.com>
Diffstat (limited to 'lib/zebra.h')
| -rw-r--r-- | lib/zebra.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/zebra.h b/lib/zebra.h index b2f5e5a848..455db9c64e 100644 --- a/lib/zebra.h +++ b/lib/zebra.h @@ -338,6 +338,15 @@ struct in_pktinfo { #define strmatch(a,b) (!strcmp((a), (b))) +#define htonll(x) \ + ((1 == htonl(1)) \ + ? (x) \ + : ((uint64_t)htonl((x)&0xFFFFFFFF) << 32) | htonl((x) >> 32)) +#define ntohll(x) \ + ((1 == ntohl(1)) \ + ? (x) \ + : ((uint64_t)ntohl((x)&0xFFFFFFFF) << 32) | ntohl((x) >> 32)) + #ifndef INADDR_LOOPBACK #define INADDR_LOOPBACK 0x7f000001 /* Internet address 127.0.0.1. */ #endif |
