Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Aris_Basic
New Contributor I
46 Views

Convrt/ReduceBits 8u1u rotate content of resulting byte ?

Convrt/ReduceBits 8u1u rotate content of resulting byte ?
is there a simple way of rotating content of resulting byte of hose functions ? (bit 7 becomes 0 ... 0 -> 7 etc)
Edit:
maybe reversing bit order is more appropriate name
0 Kudos
3 Replies
Ying_H_Intel
Employee
46 Views

Hello,

Could you give a sample to show the functionality, for example, the input data type and size, the output date type? Convert_8u1u or ReduceBit 8u1u just convert, no rotate

If shift by bit, intel compiler's intrinsics function seems be able to do this. for example


unsigned int _rotl(unsigned int value, int shift)

Implements 32-bit left rotate of value by shift positions.

unsigned int _rotr(unsigned int value, int shift)

Implements 32-bit right rotate of value by shift positions.

Intrinsics for IA-32 and Intel 64 Architectures

unsigned short _rotwl(unsigned short value, int shift)

Implements 16-bit left rotate of value by shift positions.

unsigned short _rotwr(unsigned short value, int shift)

Implements 16-bit right rotate of value by shift positions.


Best Regards,
Ying H.

SergeyKostrov
Valued Contributor II
46 Views

Quoting Aris Basic
...
is there a simple way of rotating content of resulting byte of hose functions ? (bit 7 becomes 0 ... 0 -> 7 etc)
Edit:
maybe reversing bit order is more appropriate name
...


A lookup table of 255 reversed bytes.Speaking about performance nothing would compare with it.

Best regards,
Sergey

SergeyKostrov
Valued Contributor II
46 Views

This is a follow up and a genericexample provided:

...
const int iSize = < some value >;
unsigned byte ubData[ iSize ] = { 0x0 };

unsigned byte ubLUT[ 256 ] =
{
//Lookup Table ( LUT )of 256 unsigned bytes initialized with the bit reversed values
...
};
...
// ubData initialization / usage code / etc
...
for(inti = 0;i <iSize; i++ )
{
ubData = ubLUT[ ubData ];
}
...

Best regards,
Sergey

Reply