3 位运算函数

1 位与运算

            byte and(byte bt1, byte bt2)
        

2 位或运算

            byte or(byte bt1, byte bt2)
        

3 异或运算

            byte xor(byte bt1, byte bt2)
        

4 将4个字节组合成DWORD型

            dword makeDword(byte bt1, byte bt2, byte bt3, byte bt4)
        

5 将2个字节组合成int型

            int makeWord(byte bt1, byte bt2)
        

6 将DWORD型拆分成4个字节

            void splitDword(dword val, byte& bt1, byte& bt2, byte& bt3, byte& bt4)
        

7 将int型拆分成2个字节

            void splitWord(int val, byte& bt1, byte& bt2)
        

8 计算CRC校验码

            void calcCRC(byte array& bytes, int count, byte& crcHi, byte& crcLo)
        

9 计算LRC校验码

            byte calcLRC(byte array& bytes, int count)
        

10 计算LRC ASCII校验码

            byte calcLRCAscii(byte array& bytes, int count)
        

11 获取DWORD指定位的值

            byte getBit(dword d, int index)
        

12 设置DWORD指定位的值

            void setBit(dword& d, int index, byte val)
        

13 浮点型转换为WORD型

            int floatToWord(float val)
        

14 浮点型转换为DWORD

            dword floatToDword(float val)
        

15 DWORD转换为浮点型

            float dwordToFloat(dword val)