__bpermd, __builtin_bpermd

Purpose

Byte Permute Doubleword

Returns the result of a bit permutation operation.

Note: This built-in function is valid only when the compiler is in the 64-bit compilation mode.

Prototype

long long __builtin_bpermd (long long bit_selector, long long source);

long long __bpermd (long long bit_selector, long long source);

Note:
  • The built-in function in the form of __name is a synonym of __builtin_name.
  • The built-in function in the form of __name is provided for compatibility with IBM® XL C/C++ for AIX® 16.1.0 or earlier releases. This built-in function might be deprecated in the future.

Usage

Eight bits are returned, each corresponding to a bit within source, and were selected by a byte of bit_selector. If byte i of bit_selector is less than 64, the permuted bit i is set to the bit of source specified by byte i of bit_selector; otherwise, the permuted bit i is set to 0. The permuted bits are placed in the least-significant byte of the result value and the remaining bits are filled with 0s.