On Wed, 2019-03-20 at 06:14 +0100, Niels Möller wrote:
> [email protected] (Niels Möller) writes:
> 
> > 3. Big-endian system, no __builtin_bswap64. Here we can either use the
> >    current code, with byte accesses only. Or attempt to define byteswap
> >    without builtins and follow 2. I'd lean towards using the current
> >    code, unless there's some system where something more complicated is
> >    known to improve performance.
> 
> And another possible trick for big-endian is to do an "opposite-endian"
> left shift as
> 
>   ((x & 0x7f7f7f7f7f7f7f7f) << 1) | ((x & 0x8080808080808080) >> 15)
>                           where this bit is the carry out ^

This would allow us to avoid copies at the cost of more complicated code.

Which do you prefer? using endian.h where available? Or having two
separate codepaths depending on the endianess of the machine ?

Simo.

-- 
Simo Sorce
Sr. Principal Software Engineer
Red Hat, Inc


_______________________________________________
nettle-bugs mailing list
[email protected]
http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs

Reply via email to