Nicolas Mora <nico...@babelouest.org> writes:

> I've added 2 macros definitions: MSB_XOR_T_WRAP and MSB_XOR_T_UNWRAP,
> I couldn't find how to make just one macro for both cases because of
> the direction of the xor.

Hmm. Maybe better to define an optional swap operation. Like

#if WORDS_BIGENDIAN
#define bswap_if_le(x) (x)
#elif HAVE_BUILTIN_BSWAP64
#define bswap_if_le(x) (__builtin_bswap64 (x))
#else
static uint64_t
bswap_if_le(uint64_t x) 
{
  x = ((x >> 32) & UINT64_C(0xffffffff)) 
           | ((x & UINT64_C(0xffffffff)) << 32);
  x = ((x >> 16) & UINT64_C(0xffff0000ffff)) 
           | ((x & UINT64_C(0xffff0000ffff)) << 16);
  x = ((x >> 8)  & UINT64_C(0xff00ff00ff00ff)) 
           | ((x & UINT64_C(0xff00ff00ff00ff)) << 8);
  return x;
}
#endif

and then use as 

  B.u64[0] = A.u64 ^ bswap_if_le((n * j) + (i + 1));

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677.
Internet email is subject to wholesale government surveillance.
_______________________________________________
nettle-bugs mailing list
nettle-bugs@lists.lysator.liu.se
http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs

Reply via email to