### Please enter an index vector (0..31 or $0..$1f, or * for don't care):

Best method found: Bit group moving (about 39 cycles on superscalar processors):

x = (x & 0x80000800)
| ((x & 0x00000010) << 1)
| ((x & 0x00000040) << 2)
| ((x & 0x00800000) << 6)
| ((x & 0x00000080) << 7)
| rol(x & 0x40000020, 8)
| ((x & 0x00010000) << 9)
| ((x & 0x00000200) << 11)
| rol(x & 0x00080400, 16)
| ((x & 0x00002001) << 17)
| rol(x & 0x00001008, 20)
| ((x & 0x04008000) >> 11)
| ((x & 0x00120000) >> 10)
| ((x & 0x08040000) >> 9)
| ((x & 0x01000000) >> 8)
| rol(x & 0x00000102, 26)
| ((x & 0x10000000) >> 4)
| ((x & 0x02000000) >> 3)
| ((x & 0x00204000) >> 2)
| ((x & 0x20400004) >> 1);

See documentation to
bit_permute_step,
bit_permute_step_simple,
rol.

pext and pdep
can be emulated with
compress_right
and
expand_right.

This result is not necessarily the best possible,
but at least several methods have been challenged.

See also some
notes
on the inner workings.

There is an even better calculator
**calcperm.***
which is usable for various word sizes
(Pascal and C++ sources).

Error reports, comments or questions? E-mail:
info@sirrida.de

You may
bookmark
this page as
http://programming.sirrida.de?calcperm.php.

Last change: 2014-07-06