2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

types: Add big-endian 128-bit types and helpers.

These types will be used by the following patches to ensure a consistent
wire format for 128-bit connection tracking labels. Common functions for
comparison, endian translation, etc. are provided.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Joe Stringer
2015-09-22 23:24:11 -07:00
parent 81270993ab
commit 557344e3fe
4 changed files with 59 additions and 0 deletions

View File

@@ -84,10 +84,24 @@ typedef struct {
typedef union {
uint32_t u32[4];
struct {
#ifdef WORDS_BIGENDIAN
uint64_t hi, lo;
#else
uint64_t lo, hi;
#endif
} u64;
} ovs_u128;
typedef union {
ovs_be32 be32[4];
struct {
ovs_be64 hi, lo;
} be64;
} ovs_be128;
#define OVS_U128_MAX (ovs_u128) { .u64 = { UINT64_MAX, UINT64_MAX } }
#define OVS_BE128_MAX (ovs_be128) { .be64 = { OVS_BE64_MAX, OVS_BE64_MAX } }
/* A 64-bit value, in network byte order, that is only aligned on a 32-bit
* boundary. */
typedef struct {