mirror of
https://github.com/MariaDB/server.git
synced 2025-12-28 08:10:14 +00:00
Improve crc32 test data
Previously, the buffer used to check that long CRC32 produce the right results, was initialized with the same value repeated in every byte. This is subobtimal as it can't detect bugs in which a 8-byte SIMD unit of data is loaded and processed in the wrong endianness. Improve the test by initializing the buffer with a pattern that does not repeat along power-of-two boundaries. 251 was picked as the highest prime number that fits in a byte.
This commit is contained in:
parent
40e55f9ab9
commit
175208a284
@ -136,7 +136,8 @@ int main(int argc __attribute__((unused)),char *argv[])
|
||||
DO_TEST_CRC32C(0,STR,(sizeof(STR)-1));
|
||||
ok(0 == my_crc32c(0, NULL, 0), "crc32c data = NULL, length = 0");
|
||||
|
||||
memset(buf, 0x5a, sizeof buf);
|
||||
for (size_t i = 0; i < sizeof buf; i++)
|
||||
buf[i] = i % 251;
|
||||
ok(0 == test_buf(my_checksum, crc32), "crc32 with various lengths");
|
||||
ok(0 == test_buf(my_crc32c, crc32c), "crc32c with various lengths");
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user