]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Move CRC tables to rodata section
authoruis <uis9936@gmail.com>
Sun, 21 Apr 2024 16:23:51 +0000 (19:23 +0300)
committeruis <uis9936@gmail.com>
Sat, 27 Apr 2024 23:30:07 +0000 (02:30 +0300)
common.c

index badf4c9ccaca487160a3af26f8d2f3d14fd870df..66fb0beb3407e9b0f7173b6f359772e0382a140e 100644 (file)
--- a/common.c
+++ b/common.c
@@ -142,7 +142,7 @@ void StoreLittleShort (unsigned char *buffer, unsigned short i)
 #define CRC_INIT_VALUE 0xffff
 #define CRC_XOR_VALUE  0x0000
 
-static unsigned short crctable[256] =
+static const uint16_t crctable[256] =
 {
        0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
        0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef,
@@ -195,7 +195,7 @@ unsigned short CRC_Block_CaseInsensitive(const unsigned char *data, size_t size)
 }
 
 // QuakeWorld
-static unsigned char chktbl[1024 + 4] =
+static const uint8_t chktbl[1024 + 4] =
 {
        0x78,0xd2,0x94,0xe3,0x41,0xec,0xd6,0xd5,0xcb,0xfc,0xdb,0x8a,0x4b,0xcc,0x85,0x01,
        0x23,0xd2,0xe5,0xf2,0x29,0xa7,0x45,0x94,0x4a,0x62,0xe3,0xa5,0x6f,0x3f,0xe1,0x7a,
@@ -237,7 +237,7 @@ static unsigned char chktbl[1024 + 4] =
 // QuakeWorld
 unsigned char COM_BlockSequenceCRCByteQW(unsigned char *base, int length, int sequence)
 {
-       unsigned char *p;
+       const unsigned char *p;
        unsigned char chkb[60 + 4];
 
        p = chktbl + (sequence % (sizeof(chktbl) - 8));