| 2cd40ea1 Andy McCall ↶ |
1 |
|
| 2 |
|
| 3 |
#![allow(dead_code)] |
| 4 |
|
| 5 |
use crate::consts::*; |
| 6 |
use crate::structs::Algorithm; |
| 7 |
use crate::CrcAlgorithm; |
| 8 |
use crate::CrcParams; |
| 9 |
|
| 10 |
pub const CRC_64_ECMA_182: Algorithm<u64> = Algorithm { |
| 11 |
width: 64, |
| 12 |
poly: 0x42f0e1eba9ea3693, |
| 13 |
init: 0x0, |
| 14 |
refin: false, |
| 15 |
refout: false, |
| 16 |
xorout: 0x0, |
| 17 |
check: 0x6c40df5f0b497347, |
| 18 |
residue: 0x0, |
| 19 |
}; |
| 20 |
|
| 21 |
pub const CRC_64_GO_ISO: Algorithm<u64> = Algorithm { |
| 22 |
width: 64, |
| 23 |
poly: 0x1b, |
| 24 |
init: 0xffffffffffffffff, |
| 25 |
refin: true, |
| 26 |
refout: true, |
| 27 |
xorout: 0xffffffffffffffff, |
| 28 |
check: 0xb90956c775a41001, |
| 29 |
residue: 0x5300000000000000, |
| 30 |
}; |
| 31 |
|
| 32 |
pub const CRC_64_MS: Algorithm<u64> = Algorithm { |
| 33 |
width: 64, |
| 34 |
poly: 0x259c84cba6426349, |
| 35 |
init: 0xffffffffffffffff, |
| 36 |
refin: true, |
| 37 |
refout: true, |
| 38 |
xorout: 0x0, |
| 39 |
check: 0x75d4b74f024eceea, |
| 40 |
residue: 0x0, |
| 41 |
}; |
| 42 |
|
| 43 |
pub const CRC_64_NVME: Algorithm<u64> = Algorithm { |
| 44 |
width: 64, |
| 45 |
poly: 0xad93d23594c93659, |
| 46 |
init: 0xffffffffffffffff, |
| 47 |
refin: true, |
| 48 |
refout: true, |
| 49 |
xorout: 0xffffffffffffffff, |
| 50 |
check: 0xae8b14860a799888, |
| 51 |
residue: 0xf310303b2b6f6e42, |
| 52 |
}; |
| 53 |
|
| 54 |
pub const CRC_64_REDIS: Algorithm<u64> = Algorithm { |
| 55 |
width: 64, |
| 56 |
poly: 0xad93d23594c935a9, |
| 57 |
init: 0x0, |
| 58 |
refin: true, |
| 59 |
refout: true, |
| 60 |
xorout: 0x0, |
| 61 |
check: 0xe9c6d914c4b8d9ca, |
| 62 |
residue: 0x0, |
| 63 |
}; |
| 64 |
|
| 65 |
pub const CRC_64_WE: Algorithm<u64> = Algorithm { |
| 66 |
width: 64, |
| 67 |
poly: 0x42f0e1eba9ea3693, |
| 68 |
init: 0xffffffffffffffff, |
| 69 |
refin: false, |
| 70 |
refout: false, |
| 71 |
xorout: 0xffffffffffffffff, |
| 72 |
check: 0x62ec59e3f1a4f00a, |
| 73 |
residue: 0xfcacbebd5931a992, |
| 74 |
}; |
| 75 |
|
| 76 |
pub const CRC_64_XZ: Algorithm<u64> = Algorithm { |
| 77 |
width: 64, |
| 78 |
poly: 0x42f0e1eba9ea3693, |
| 79 |
init: 0xffffffffffffffff, |
| 80 |
refin: true, |
| 81 |
refout: true, |
| 82 |
xorout: 0xffffffffffffffff, |
| 83 |
check: 0x995dc9bbdf1939fa, |
| 84 |
residue: 0x49958c9abd7d353f, |
| 85 |
}; |
| 86 |
|
| 87 |
|
| 88 |
pub const CRC64_ECMA_182: CrcParams = CrcParams { |
| 89 |
algorithm: CrcAlgorithm::Crc64Ecma182, |
| 90 |
name: NAME_CRC64_ECMA_182, |
| 91 |
width: CRC_64_ECMA_182.width, |
| 92 |
poly: CRC_64_ECMA_182.poly, |
| 93 |
init: CRC_64_ECMA_182.init, |
| 94 |
init_algorithm: CRC_64_ECMA_182.init, |
| 95 |
refin: CRC_64_ECMA_182.refin, |
| 96 |
refout: CRC_64_ECMA_182.refout, |
| 97 |
xorout: CRC_64_ECMA_182.xorout, |
| 98 |
check: CRC_64_ECMA_182.check, |
| 99 |
keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_42F0E1EBA9EA3693_FORWARD), |
| 100 |
}; |
| 101 |
|
| 102 |
|
| 103 |
pub const CRC64_GO_ISO: CrcParams = CrcParams { |
| 104 |
algorithm: CrcAlgorithm::Crc64GoIso, |
| 105 |
name: NAME_CRC64_GO_ISO, |
| 106 |
width: CRC_64_GO_ISO.width, |
| 107 |
poly: CRC_64_GO_ISO.poly, |
| 108 |
init: CRC_64_GO_ISO.init, |
| 109 |
init_algorithm: CRC_64_GO_ISO.init, |
| 110 |
refin: CRC_64_GO_ISO.refin, |
| 111 |
refout: CRC_64_GO_ISO.refout, |
| 112 |
xorout: CRC_64_GO_ISO.xorout, |
| 113 |
check: CRC_64_GO_ISO.check, |
| 114 |
keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_000000000000001B_REFLECTED), |
| 115 |
}; |
| 116 |
|
| 117 |
|
| 118 |
pub const CRC64_MS: CrcParams = CrcParams { |
| 119 |
algorithm: CrcAlgorithm::Crc64Ms, |
| 120 |
name: NAME_CRC64_MS, |
| 121 |
width: 64, |
| 122 |
poly: CRC_64_MS.poly, |
| 123 |
init: CRC_64_MS.init, |
| 124 |
init_algorithm: CRC_64_MS.init, |
| 125 |
refin: CRC_64_MS.refin, |
| 126 |
refout: CRC_64_MS.refout, |
| 127 |
xorout: CRC_64_MS.xorout, |
| 128 |
check: CRC_64_MS.check, |
| 129 |
keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_259C84CBA6426349_REFLECTED), |
| 130 |
}; |
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
pub const CRC64_NVME: CrcParams = CrcParams { |
| 135 |
algorithm: CrcAlgorithm::Crc64Nvme, |
| 136 |
name: NAME_CRC64_NVME, |
| 137 |
width: CRC_64_NVME.width, |
| 138 |
poly: CRC_64_NVME.poly, |
| 139 |
init: CRC_64_NVME.init, |
| 140 |
init_algorithm: CRC_64_NVME.init, |
| 141 |
refin: CRC_64_NVME.refin, |
| 142 |
refout: CRC_64_NVME.refout, |
| 143 |
xorout: CRC_64_NVME.xorout, |
| 144 |
check: CRC_64_NVME.check, |
| 145 |
keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_AD93D23594C93659_REFLECTED), |
| 146 |
}; |
| 147 |
|
| 148 |
|
| 149 |
pub const CRC64_REDIS: CrcParams = CrcParams { |
| 150 |
algorithm: CrcAlgorithm::Crc64Redis, |
| 151 |
name: NAME_CRC64_REDIS, |
| 152 |
width: CRC_64_REDIS.width, |
| 153 |
poly: CRC_64_REDIS.poly, |
| 154 |
init: CRC_64_REDIS.init, |
| 155 |
init_algorithm: CRC_64_REDIS.init, |
| 156 |
refin: CRC_64_REDIS.refin, |
| 157 |
refout: CRC_64_REDIS.refout, |
| 158 |
xorout: CRC_64_REDIS.xorout, |
| 159 |
check: CRC_64_REDIS.check, |
| 160 |
keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_AD93D23594C935A9_REFLECTED), |
| 161 |
}; |
| 162 |
|
| 163 |
|
| 164 |
pub const CRC64_WE: CrcParams = CrcParams { |
| 165 |
algorithm: CrcAlgorithm::Crc64We, |
| 166 |
name: NAME_CRC64_WE, |
| 167 |
width: CRC_64_WE.width, |
| 168 |
poly: CRC_64_WE.poly, |
| 169 |
init: CRC_64_WE.init, |
| 170 |
init_algorithm: CRC_64_WE.init, |
| 171 |
refin: CRC_64_WE.refin, |
| 172 |
refout: CRC_64_WE.refout, |
| 173 |
xorout: CRC_64_WE.xorout, |
| 174 |
check: CRC_64_WE.check, |
| 175 |
keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_42F0E1EBA9EA3693_FORWARD), |
| 176 |
}; |
| 177 |
|
| 178 |
|
| 179 |
pub const CRC64_XZ: CrcParams = CrcParams { |
| 180 |
algorithm: CrcAlgorithm::Crc64Xz, |
| 181 |
name: NAME_CRC64_XZ, |
| 182 |
width: CRC_64_XZ.width, |
| 183 |
poly: CRC_64_XZ.poly, |
| 184 |
init: CRC_64_XZ.init, |
| 185 |
init_algorithm: CRC_64_XZ.init, |
| 186 |
refin: CRC_64_XZ.refin, |
| 187 |
refout: CRC_64_XZ.refout, |
| 188 |
xorout: CRC_64_XZ.xorout, |
| 189 |
check: CRC_64_XZ.check, |
| 190 |
keys: crate::CrcKeysStorage::from_keys_fold_256(KEYS_42F0E1EBA9EA3693_REFLECTED), |
| 191 |
}; |
| 192 |
|
| 193 |
|
| 194 |
const KEYS_259C84CBA6426349_REFLECTED: [u64; 23] = [ |
| 195 |
0x0000000000000000, |
| 196 |
0xcef05cca14bbf4df, |
| 197 |
0xfd5d7a0700b5ba38, |
| 198 |
0xafde70a30ebb4286, |
| 199 |
0xe7a651bf12fbb17b, |
| 200 |
0xcef05cca14bbf4df, |
| 201 |
0x0000000000000000, |
| 202 |
0xd7eb06822197a109, |
| 203 |
0x258c84cba6427349, |
| 204 |
0x9f5bbc2a0e2e4c6f, |
| 205 |
0x50e15bfbd337753a, |
| 206 |
0x064a94c5212d44f4, |
| 207 |
0x4aaa0531d46f3c70, |
| 208 |
0xebd4e5a2eb6d83a1, |
| 209 |
0x295b872fea8473f0, |
| 210 |
0xa62bc2d50bf03c03, |
| 211 |
0xd3e2dc3a51dacee1, |
| 212 |
0x4aa4564b4042092b, |
| 213 |
0x717984ed338c465f, |
| 214 |
0x70bd522114faceb8, |
| 215 |
0x2188097f5687b43c, |
| 216 |
0xb7c2f9fa47c4fe55, |
| 217 |
0x8dccaf9d6169d0fa, |
| 218 |
]; |
| 219 |
|
| 220 |
|
| 221 |
const KEYS_AD93D23594C935A9_REFLECTED: [u64; 23] = [ |
| 222 |
0x0000000000000000, |
| 223 |
0x381d0015c96f4444, |
| 224 |
0xd9d7be7d505da32c, |
| 225 |
0x768361524d29ed0b, |
| 226 |
0xcc26fa7c57f8054c, |
| 227 |
0x381d0015c96f4444, |
| 228 |
0x0000000000000000, |
| 229 |
0x3e6cfa329aef9f77, |
| 230 |
0x2b5926535897936b, |
| 231 |
0x5bc94ba8e2087636, |
| 232 |
0x6cf09c8f37710b75, |
| 233 |
0x3885fd59e440d95a, |
| 234 |
0xbccba3936411fb7e, |
| 235 |
0xe4dd0d81cbfce585, |
| 236 |
0xb715e37b96ed8633, |
| 237 |
0xf49784a634f014e4, |
| 238 |
0xaf86efb16d9ab4fb, |
| 239 |
0x7b3211a760160db8, |
| 240 |
0xa062b2319d66692f, |
| 241 |
0xef3d1d18ed889ed2, |
| 242 |
0x6ba4d760ab38201e, |
| 243 |
0x9471a5389095fe44, |
| 244 |
0x9a8908341a6d6d52, |
| 245 |
]; |
| 246 |
|
| 247 |
|
| 248 |
const KEYS_42F0E1EBA9EA3693_FORWARD: [u64; 23] = [ |
| 249 |
0x0000000000000000, |
| 250 |
0x05f5c3c7eb52fab6, |
| 251 |
0x4eb938a7d257740e, |
| 252 |
0x05cf79dea9ac37d6, |
| 253 |
0x001067e571d7d5c2, |
| 254 |
0x05f5c3c7eb52fab6, |
| 255 |
0x0000000000000000, |
| 256 |
0x578d29d06cc4f872, |
| 257 |
0x42f0e1eba9ea3693, |
| 258 |
0xe464f4df5fb60ac1, |
| 259 |
0xb649c5b35a759cf2, |
| 260 |
0x9af04e1eff82d0dd, |
| 261 |
0x6e82e609297f8fe8, |
| 262 |
0x097c516e98bd2e73, |
| 263 |
0x0b76477b31e22e7b, |
| 264 |
0x5f6843ca540df020, |
| 265 |
0xddf4b6981205b83f, |
| 266 |
0x54819d8713758b2c, |
| 267 |
0x4a6b90073eb0af5a, |
| 268 |
0x571bee0a227ef92b, |
| 269 |
0x44bef2a201b5200c, |
| 270 |
0x7f52691a60ddc70d, |
| 271 |
0x7036b0389f6a0c82, |
| 272 |
]; |
| 273 |
|
| 274 |
|
| 275 |
const KEYS_42F0E1EBA9EA3693_REFLECTED: [u64; 23] = [ |
| 276 |
0x0000000000000000, |
| 277 |
0xdabe95afc7875f40, |
| 278 |
0xe05dd497ca393ae4, |
| 279 |
0xd7d86b2af73de740, |
| 280 |
0x8757d71d4fcc1000, |
| 281 |
0xdabe95afc7875f40, |
| 282 |
0x0000000000000000, |
| 283 |
0x9c3e466c172963d5, |
| 284 |
0x92d8af2baf0e1e85, |
| 285 |
0x947874de595052cb, |
| 286 |
0x9e735cb59b4724da, |
| 287 |
0xe4ce2cd55fea0037, |
| 288 |
0x2fe3fd2920ce82ec, |
| 289 |
0x0e31d519421a63a5, |
| 290 |
0x2e30203212cac325, |
| 291 |
0x081f6054a7842df4, |
| 292 |
0x6ae3efbb9dd441f3, |
| 293 |
0x69a35d91c3730254, |
| 294 |
0xb5ea1af9c013aca4, |
| 295 |
0x3be653a30fe1af51, |
| 296 |
0x60095b008a9efa44, |
| 297 |
0xf31fd9271e228b79, |
| 298 |
0x8260adf2381ad81c, |
| 299 |
]; |
| 300 |
|
| 301 |
|
| 302 |
const KEYS_000000000000001B_REFLECTED: [u64; 23] = [ |
| 303 |
0x0000000000000000, |
| 304 |
0xf500000000000001, |
| 305 |
0x6b70000000000001, |
| 306 |
0xb001000000010000, |
| 307 |
0xf501b0000001b000, |
| 308 |
0xf500000000000001, |
| 309 |
0x0000000000000000, |
| 310 |
0xb000000000000001, |
| 311 |
0xb000000000000001, |
| 312 |
0xe014514514501501, |
| 313 |
0x771db6db6db71c71, |
| 314 |
0xa101101101110001, |
| 315 |
0x1ab1ab1ab1aab001, |
| 316 |
0xf445014445000001, |
| 317 |
0x6aab71daab700001, |
| 318 |
0xb100010100000001, |
| 319 |
0x01b001b1b0000001, |
| 320 |
0xe145150000000001, |
| 321 |
0x76db6c7000000001, |
| 322 |
0xa011000000000001, |
| 323 |
0x1b1ab00000000001, |
| 324 |
0x45000000b0000000, |
| 325 |
0x6b700000f5000000, |
| 326 |
]; |
| 327 |
|
| 328 |
|
| 329 |
const KEYS_AD93D23594C93659_REFLECTED: [u64; 23] = [ |
| 330 |
0x0000000000000000, |
| 331 |
0x21e9_761e_2526_21ac, |
| 332 |
0xeadc_41fd_2ba3_d420, |
| 333 |
0x5f85_2fb6_1e8d_92dc, |
| 334 |
0xa1ca_681e_733f_9c40, |
| 335 |
0x21e9_761e_2526_21ac, |
| 336 |
0x0000000000000000, |
| 337 |
0x27ec_fa32_9aef_9f77, |
| 338 |
0x34d9_2653_5897_936b, |
| 339 |
0x9465_8840_3d4a_dcbc, |
| 340 |
0xd083_dd59_4d96_319d, |
| 341 |
0x34f5_a24e_22d6_6e90, |
| 342 |
0x3c25_5f5e_bc41_4423, |
| 343 |
0x0336_3823_e6e7_91e5, |
| 344 |
0x7b0a_b10d_d0f8_09fe, |
| 345 |
0x6224_2240_ace5_045a, |
| 346 |
0x0c32_cdb3_1e18_a84a, |
| 347 |
0xa3ff_dc1f_e8e8_2a8b, |
| 348 |
0xbdd7_ac0e_e1a4_a0f0, |
| 349 |
0xe1e0_bb9d_45d7_a44c, |
| 350 |
0xb0bc_2e58_9204_f500, |
| 351 |
0xa043_808c_0f78_2663, |
| 352 |
0x37cc_d3e1_4069_cabc, |
| 353 |
]; |
| 354 |
|
| 355 |
pub const SIMD_CONSTANTS: [[u64; 2]; 4] = [ |
| 356 |
[0x08090a0b0c0d0e0f, 0x0001020304050607], |
| 357 |
[0x8080808080808080, 0x8080808080808080], |
| 358 |
[0xffffffffffffffff, 0x00000000ffffffff], |
| 359 |
[0x0000000000000000, 0xffffffffffffffff], |
| 360 |
]; |
| 361 |
|
| 362 |
|
| 363 |
#[repr(C, align(16))] |
| 364 |
pub struct AlignedTableReverse { |
| 365 |
row1: [u8; 16], |
| 366 |
row2: [u8; 16], |
| 367 |
} |
| 368 |
|
| 369 |
pub const PSBTBL_REVERSE: AlignedTableReverse = AlignedTableReverse { |
| 370 |
row1: [ |
| 371 |
|
| 372 |
0x00, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, |
| 373 |
0x8f, |
| 374 |
], |
| 375 |
row2: [ |
| 376 |
|
| 377 |
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 378 |
0x00, |
| 379 |
], |
| 380 |
}; |
| 381 |
|
| 382 |
#[repr(C, align(16))] |
| 383 |
pub struct AlignedTableForward { |
| 384 |
row1: [u8; 16], |
| 385 |
row2: [u8; 16], |
| 386 |
row3: [u8; 16], |
| 387 |
row4: [u8; 16], |
| 388 |
} |
| 389 |
|
| 390 |
pub const PSBTBL_FORWARD: AlignedTableForward = AlignedTableForward { |
| 391 |
|
| 392 |
row1: [ |
| 393 |
0x00, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, |
| 394 |
0x8f, |
| 395 |
], |
| 396 |
|
| 397 |
row2: [ |
| 398 |
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 399 |
0x0f, |
| 400 |
], |
| 401 |
|
| 402 |
row3: [ |
| 403 |
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 404 |
0x0f, |
| 405 |
], |
| 406 |
|
| 407 |
row4: [ |
| 408 |
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
| 409 |
0x80, |
| 410 |
], |
| 411 |
}; |