summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAdam Stylinski <kungfujesus06@gmail.com>2025-03-25 17:58:19 -0400
committerHans Kristian Rosbach <hk-github@circlestorm.org>2025-03-28 15:29:11 +0100
commit18b933b88ae3ed470321b2435ddfef0ca117c509 (patch)
tree24b4ce6113d35a9fb5aee1e295d6ee67c6db42b4 /test
parent64d16e10bc08f94453e31c77ba658efa997c651a (diff)
downloadProject-Tick-18b933b88ae3ed470321b2435ddfef0ca117c509.tar.gz
Project-Tick-18b933b88ae3ed470321b2435ddfef0ca117c509.zip
Fix a bug on the 32k and greater chorba specializations
In testing a SIMD vectorization for this, I wrote a gtest which stumbled onto the fact that this had a bug on big endian. Before the initial CRC had been mixed in it needed to be byte swapped.
Diffstat (limited to 'test')
-rw-r--r--test/test_crc32.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/test/test_crc32.cc b/test/test_crc32.cc
index d2eb44d358..ee301ef602 100644
--- a/test/test_crc32.cc
+++ b/test/test_crc32.cc
@@ -26,6 +26,19 @@ typedef struct {
unsigned long expect;
} crc32_test;
+ALIGNED_(16) uint8_t fullwin_buf[32768];
+
+uint8_t* setup_buf() {
+ for (int i = 0; i < 32768; ++i) {
+ unsigned char ic = (unsigned char)(i % 256);
+ fullwin_buf[i] = ic;
+ }
+
+ return fullwin_buf;
+}
+
+static uint8_t *buf32k = setup_buf();
+
static const crc32_test tests[] = {
{0x0, (const uint8_t *)0x0, 0, 0x0},
{0xffffffff, (const uint8_t *)0x0, 0, 0x0},
@@ -179,7 +192,8 @@ static const crc32_test tests[] = {
"h{bcmdC+a;t+Cf{6Y_dFq-{X4Yu&7uNfVDh?q&_u.UWJU],-GiH7ADzb7-V.Q%4=+v!$L9W+T=bP]$_:]Vyg}A.ygD.r;h-D]m%&"
"h{bcmdC+a;t+Cf{6Y_dFq-{X4Yu&7uNfVDh?q&_u.UWJU],-GiH7ADzb7-V.Q%4=+v!$L9W+T=bP]$_:]Vyg}A.ygD.r;h-D]m%&"
"h{bcmdC+a;t+Cf{6Y_dFq-{X4Yu&7uNfVDh?q&_u.UWJU],-GiH7ADzb7-V.Q%4=+v!$L9W+T=bP]$_:]Vyg}A.ygD.r;h-D]m%&"
- "h{bcmdC+a;t+Cf{6Y_dFq-{X4Yu&7uNfVDh?q&_u.UWJU],-GiH7ADzb7-V.Q%4=+v!$L9W+T=bP]$_:]Vyg}A.ygD.r;h-D]m%&", 600, 0x888AFA5B}
+ "h{bcmdC+a;t+Cf{6Y_dFq-{X4Yu&7uNfVDh?q&_u.UWJU],-GiH7ADzb7-V.Q%4=+v!$L9W+T=bP]$_:]Vyg}A.ygD.r;h-D]m%&", 600, 0x888AFA5B},
+ {0x0, buf32k, 32768, 0x217726B2}
};
class crc32_variant : public ::testing::TestWithParam<crc32_test> {