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

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

x = (x & 0x00400001)
| ((x & 0x00000002) << 1)
| ((x & 0x00008000) << 4)
| ((x & 0x00000100) << 7)
| ((x & 0x00040020) << 8)
| rol(x & 0x84000800, 9)
| ((x & 0x00020000) << 10)
| rol(x & 0x02000200, 12)
| ((x & 0x00010000) << 13)
| rol(x & 0x40000400, 14)
| ((x & 0x01000000) >> 17)
| ((x & 0x00004000) << 16)
| rol(x & 0x00080040, 17)
| ((x & 0x28000000) >> 13)
| ((x & 0x00200000) >> 12)
| ((x & 0x00000090) << 21)
| ((x & 0x10000000) >> 10)
| ((x & 0x00100000) >> 9)
| ((x & 0x00801000) >> 6)
| rol(x & 0x00002004, 29)
| ((x & 0x00000008) >> 2);

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