On 10/27/2016 01:36 AM, Nikunj A Dadhania wrote:
Right, it does reduce number of operations:
+#define SIZE_MASK(x) ((1ULL << (x)) - 1)
+static uint64_t vparity(uint64_t f1, uint64_t f2, int size)
+{
+ uint64_t res = f1 ^ f2;
+ if (size == 8) return res;
+ return vparity(res & SIZE_MASK(size/2), res >> (size/2), size/2);
+}
Why are you using recursion for something that should be 5 operations? You're
making this more complicated than it needs to be.
uint64_t res = b->u64[0] ^ b->u64[1];
res ^= res >> 32;
res ^= res >> 16;
res ^= res >> 8;
r->u64[LO_IDX] = res & 1;
r~