Skip to content

Commit

Permalink
public: use standard uint32_t in place of dword
Browse files Browse the repository at this point in the history
  • Loading branch information
a1batross committed Jun 13, 2023
1 parent 93ee5b9 commit 996897e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
16 changes: 8 additions & 8 deletions public/crclib.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ GNU General Public License for more details.
#define CRC32_INIT_VALUE 0xFFFFFFFFUL
#define CRC32_XOR_VALUE 0xFFFFFFFFUL

static const dword crc32table[NUM_BYTES] =
static const uint32_t crc32table[NUM_BYTES] =
{
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba,
0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
Expand Down Expand Up @@ -90,26 +90,26 @@ static const dword crc32table[NUM_BYTES] =
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
};

void GAME_EXPORT CRC32_Init( dword *pulCRC )
void GAME_EXPORT CRC32_Init( uint32_t *pulCRC )
{
*pulCRC = CRC32_INIT_VALUE;
}

dword GAME_EXPORT CRC32_Final( dword pulCRC )
uint32_t GAME_EXPORT CRC32_Final( uint32_t pulCRC )
{
return pulCRC ^ CRC32_XOR_VALUE;
}

void GAME_EXPORT CRC32_ProcessByte( dword *pulCRC, byte ch )
void GAME_EXPORT CRC32_ProcessByte( uint32_t *pulCRC, byte ch )
{
dword ulCrc = *pulCRC;
uint32_t ulCrc = *pulCRC;

*pulCRC = crc32table[((byte)ulCrc ^ ch)] ^ (ulCrc >> 8);
}

void GAME_EXPORT CRC32_ProcessBuffer( dword *pulCRC, const void *pBuffer, int nBuffer )
void GAME_EXPORT CRC32_ProcessBuffer( uint32_t *pulCRC, const void *pBuffer, int nBuffer )
{
dword ulCrc = *pulCRC, tmp;
uint32_t ulCrc = *pulCRC, tmp;
byte *pb = (byte *)pBuffer;

while( nBuffer >= sizeof( uint64_t ))
Expand Down Expand Up @@ -159,7 +159,7 @@ For proxy protecting
*/
byte CRC32_BlockSequence( byte *base, int length, int sequence )
{
dword CRC;
uint32_t CRC;
char *ptr;
char buffer[64];

Expand Down
9 changes: 4 additions & 5 deletions public/crclib.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@ typedef struct
uint in[16];
} MD5Context_t;


void CRC32_Init( dword *pulCRC );
void CRC32_Init( uint32_t *pulCRC );
byte CRC32_BlockSequence( byte *base, int length, int sequence );
void CRC32_ProcessBuffer( dword *pulCRC, const void *pBuffer, int nBuffer );
void CRC32_ProcessByte( dword *pulCRC, byte ch );
dword CRC32_Final( dword pulCRC );
void CRC32_ProcessBuffer( uint32_t *pulCRC, const void *pBuffer, int nBuffer );
void CRC32_ProcessByte( uint32_t *pulCRC, byte ch );
uint32_t CRC32_Final( uint32_t pulCRC );
void MD5Init( MD5Context_t *ctx );
void MD5Update( MD5Context_t *ctx, const byte *buf, uint len );
void MD5Final( byte digest[16], MD5Context_t *ctx );
Expand Down

0 comments on commit 996897e

Please sign in to comment.