equal
deleted
inserted
replaced
69 unsigned long ulPolynomial = 0x04C11DB7; |
69 unsigned long ulPolynomial = 0x04C11DB7; |
70 memset(&ulTable, 0, sizeof(ulTable)); |
70 memset(&ulTable, 0, sizeof(ulTable)); |
71 for(int iCodes = 0; iCodes <= 0xFF; iCodes++) { |
71 for(int iCodes = 0; iCodes <= 0xFF; iCodes++) { |
72 ulTable[iCodes] = Reflect(iCodes, 8) << 24; |
72 ulTable[iCodes] = Reflect(iCodes, 8) << 24; |
73 for(int iPos = 0; iPos < 8; iPos++) { |
73 for(int iPos = 0; iPos < 8; iPos++) { |
74 ulTable[iCodes] = (ulTable[iCodes] << 1) |
74 ulTable[iCodes] = ((ulTable[iCodes] << 1) & 0xffffffff) |
75 ^ ((ulTable[iCodes] & (1 << 31)) ? ulPolynomial : 0); |
75 ^ ((ulTable[iCodes] & (1 << 31)) ? ulPolynomial : 0); |
76 } |
76 } |
77 |
77 |
78 ulTable[iCodes] = Reflect(ulTable[iCodes], 32); |
78 ulTable[iCodes] = Reflect(ulTable[iCodes], 32); |
79 } |
79 } |
82 { |
82 { |
83 unsigned long ulValue = 0; |
83 unsigned long ulValue = 0; |
84 // Swap bit 0 for bit 7, bit 1 For bit 6, etc.... |
84 // Swap bit 0 for bit 7, bit 1 For bit 6, etc.... |
85 for(int iPos = 1; iPos < (cChar + 1); iPos++) { |
85 for(int iPos = 1; iPos < (cChar + 1); iPos++) { |
86 if(ulReflect & 1) { |
86 if(ulReflect & 1) { |
87 ulValue |= (1 << (cChar - iPos)); |
87 ulValue |= (1ul << (cChar - iPos)); |
88 } |
88 } |
89 ulReflect >>= 1; |
89 ulReflect >>= 1; |
90 } |
90 } |
91 return ulValue; |
91 return ulValue; |
92 } |
92 } |