24 #ifndef include_vnet_math64_h 25 #define include_vnet_math64_h 43 u32 cy = (
u32) (((p0 >> 32) + (
u32) p1 + (
u32) p2) >> 32);
45 *lo = p0 + (p1 << 32) + (p2 << 32);
46 *hi = p3 + (p1 >> 32) + (p2 >> 32) + cy;
50 #define TWO64 18446744073709551616.0 59 dq = (
TWO64 * (double)x + (
double)
y) * di;
62 q1 = 0xfffffffffffff800L;
70 if (x < p1 || (x == p1 && y < p0))
73 x = p1 - (x + (p0 <
y));
77 q2 = (
u64) ((
TWO64 * (
double)x + (
double)y) *
di);
81 if (x < p1 || (x == p1 && y <= p0))
94 x = x - (p1 + (y < p0));
97 q2 = (
u64) ((
TWO64 * (
double)x + (
double)y) *
di);
101 if (x < p1 || (x == p1 && y < p0))
142 u64 shi = 0, slo = 0;
144 add64(a, b, &shi, &slo);
153 u64 phi = 0, plo = 0;
adds_epu subs_epu i16x8 y
static void add64(u64 a, u64 b, u64 *whi, u64 *wlo)
static u64 mul64_mod(u64 a, u64 b, u64 p, double pi)
static u64 add64_mod(u64 a, u64 b, u64 p, double pi)
static u64 mod128by64(u64 x, u64 y, u64 m, double di)
static void mul64by64(u64 a, u64 b, u64 *hi, u64 *lo)
static u64 mod64by64(u64 a, u64 p, u64 primeinv)