From e03e1d6bfbd976ec23af197d0d88ccff1933e430 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 2 Jul 2018 11:59:00 +0100 Subject: [PATCH] [Minor] Fix build with gcc 4.2 Issue: #2317 Closes: #2317 --- contrib/t1ha/t1ha_bits.h | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/contrib/t1ha/t1ha_bits.h b/contrib/t1ha/t1ha_bits.h index 454e43aed..799737d5f 100644 --- a/contrib/t1ha/t1ha_bits.h +++ b/contrib/t1ha/t1ha_bits.h @@ -1063,11 +1063,13 @@ typedef union t1ha_uint128 { #endif struct { #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ - uint64_t l, h; + uint64_t l; + uint64_t h; #else - uint64_t h, l; + uint64_t h; + uint64_t l; #endif - }; + } p; } t1ha_uint128_t; static __always_inline t1ha_uint128_t not128(const t1ha_uint128_t v) { @@ -1076,8 +1078,8 @@ static __always_inline t1ha_uint128_t not128(const t1ha_uint128_t v) { (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 128) r.v = ~v.v; #else - r.l = ~v.l; - r.h = ~v.h; + r.p.l = ~v.p.l; + r.p.h = ~v.p.h; #endif return r; } @@ -1090,8 +1092,8 @@ static __always_inline t1ha_uint128_t left128(const t1ha_uint128_t v, (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 128) r.v = v.v << s; #else - r.l = (s < 64) ? v.l << s : 0; - r.h = (s < 64) ? (v.h << s) | (s ? v.l >> (64 - s) : 0) : v.l << (s - 64); + r.p.l = (s < 64) ? v.p.l << s : 0; + r.p.h = (s < 64) ? (v.p.h << s) | (s ? v.p.l >> (64 - s) : 0) : v.p.l << (s - 64); #endif return r; } @@ -1104,8 +1106,8 @@ static __always_inline t1ha_uint128_t right128(const t1ha_uint128_t v, (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 128) r.v = v.v >> s; #else - r.l = (s < 64) ? (s ? v.h << (64 - s) : 0) | (v.l >> s) : v.h >> (s - 64); - r.h = (s < 64) ? v.h >> s : 0; + r.p.l = (s < 64) ? (s ? v.p.h << (64 - s) : 0) | (v.p.l >> s) : v.p.h >> (s - 64); + r.p.h = (s < 64) ? v.p.h >> s : 0; #endif return r; } @@ -1117,8 +1119,8 @@ static __always_inline t1ha_uint128_t or128(t1ha_uint128_t x, (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 128) r.v = x.v | y.v; #else - r.l = x.l | y.l; - r.h = x.h | y.h; + r.p.l = x.p.l | y.p.l; + r.p.h = x.p.h | y.p.h; #endif return r; } @@ -1130,8 +1132,8 @@ static __always_inline t1ha_uint128_t xor128(t1ha_uint128_t x, (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 128) r.v = x.v ^ y.v; #else - r.l = x.l ^ y.l; - r.h = x.h ^ y.h; + r.p.l = x.p.l ^ y.p.l; + r.p.h = x.p.h ^ y.p.h; #endif return r; } @@ -1154,7 +1156,7 @@ static __always_inline t1ha_uint128_t add128(t1ha_uint128_t x, (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 128) r.v = x.v + y.v; #else - add64carry_last(add64carry_first(x.l, y.l, &r.l), x.h, y.h, &r.h); + add64carry_last(add64carry_first(x.p.l, y.p.l, &r.p.l), x.p.h, y.p.h, &r.p.h); #endif return r; } @@ -1166,8 +1168,8 @@ static __always_inline t1ha_uint128_t mul128(t1ha_uint128_t x, (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 128) r.v = x.v * y.v; #else - r.l = mul_64x64_128(x.l, y.l, &r.h); - r.h += x.l * y.h + y.l * x.h; + r.p.l = mul_64x64_128(x.p.l, y.p.l, &r.p.h); + r.p.h += x.p.l * y.p.h + y.p.l * x.p.h; #endif return r; } -- 2.39.5