39 lines
625 B
C++
39 lines
625 B
C++
#ifndef _ALADIN_BITMANIP_HPP_
|
|
#define _ALADIN_BITMANIP_HPP_
|
|
#ifndef _COMMON_WINDOWS_HPP_
|
|
#include <common/windows.hpp>
|
|
#endif
|
|
|
|
class BitManip
|
|
{
|
|
public:
|
|
static BYTE reverse(BYTE byte);
|
|
static WORD reverse(WORD word);
|
|
};
|
|
|
|
inline
|
|
BYTE BitManip::reverse(BYTE byte)
|
|
{
|
|
BYTE temp=0;
|
|
|
|
temp|=(byte&0x80)>>7;
|
|
temp|=(byte&0x40)>>5;
|
|
temp|=(byte&0x20)>>3;
|
|
temp|=(byte&0x10)>>1;
|
|
temp|=(byte&0x08)<<1;
|
|
temp|=(byte&0x04)<<3;
|
|
temp|=(byte&0x02)<<5;
|
|
temp|=(byte&0x01)<<7;
|
|
return temp;
|
|
}
|
|
|
|
inline
|
|
WORD BitManip::reverse(WORD someData)
|
|
{
|
|
WORD tempData(someData);
|
|
|
|
someData>>=8;
|
|
someData+=tempData<<8;
|
|
return someData;
|
|
}
|
|
#endif |