aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/digest/old_crc/gencrc
diff options
context:
space:
mode:
authorsergey <sergey@yandex-team.ru>2022-02-10 16:47:29 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:29 +0300
commit5d8d1af4df7f9cd4acc021f069546c30677e7979 (patch)
tree07a39da188e8b418699f992f22d829a37a1411b2 /library/cpp/digest/old_crc/gencrc
parent32b231c8474a1ade4bdf776ade6a20341691d9d7 (diff)
downloadydb-5d8d1af4df7f9cd4acc021f069546c30677e7979.tar.gz
Restoring authorship annotation for <sergey@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/digest/old_crc/gencrc')
-rw-r--r--library/cpp/digest/old_crc/gencrc/main.cpp50
1 files changed, 25 insertions, 25 deletions
diff --git a/library/cpp/digest/old_crc/gencrc/main.cpp b/library/cpp/digest/old_crc/gencrc/main.cpp
index d5821304ce..657ec2e45e 100644
--- a/library/cpp/digest/old_crc/gencrc/main.cpp
+++ b/library/cpp/digest/old_crc/gencrc/main.cpp
@@ -1,20 +1,20 @@
#include <util/stream/output.h>
-
-#define POLY_16 0x1021
-#define POLY_32 0xEDB88320UL
+
+#define POLY_16 0x1021
+#define POLY_32 0xEDB88320UL
#define POLY_64 ULL(0xE543279765927881)
-
+
static void crc16init() {
ui32 CRCTAB16[256];
- ui32 crc;
- int i, j;
-
+ ui32 crc;
+ int i, j;
+
for (i = 0; i < 256; CRCTAB16[i++] = 0xFFFF & ((crc << 8) ^ (crc >> 8)))
- for (crc = i, j = 8; j > 0; j--)
- if (crc & 1)
- crc = (crc >> 1) ^ POLY_16;
- else
- crc >>= 1;
+ for (crc = i, j = 8; j > 0; j--)
+ if (crc & 1)
+ crc = (crc >> 1) ^ POLY_16;
+ else
+ crc >>= 1;
for (size_t k = 0; k < 256; ++k) {
Cout << " ULL(" << CRCTAB16[k] << ")";
@@ -23,19 +23,19 @@ static void crc16init() {
Cout << ",\n";
}
}
-}
-
+}
+
static void crc32init() {
ui32 CRCTAB32[256];
- ui32 crc;
- int i, j;
-
- for (i = 0; i < 256; CRCTAB32[i++] = crc)
- for (crc = i, j = 8; j > 0; j--)
- if (crc & 1)
- crc = (crc >> 1) ^ POLY_32;
- else
- crc >>= 1;
+ ui32 crc;
+ int i, j;
+
+ for (i = 0; i < 256; CRCTAB32[i++] = crc)
+ for (crc = i, j = 8; j > 0; j--)
+ if (crc & 1)
+ crc = (crc >> 1) ^ POLY_32;
+ else
+ crc >>= 1;
for (size_t k = 0; k < 256; ++k) {
Cout << " ULL(" << CRCTAB32[k] << ")";
@@ -44,8 +44,8 @@ static void crc32init() {
Cout << ",\n";
}
}
-}
-
+}
+
int main() {
Cout << "static const ui32 CRCTAB16[] = {\n\n";
crc16init();