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
commit05f59b2581f074c756adaee6b260014ac3a0c3ec (patch)
tree9814fbd1c3effac9b8377c5d604b367b14e2db55 /library/cpp/digest/old_crc/gencrc
parent5d8d1af4df7f9cd4acc021f069546c30677e7979 (diff)
downloadydb-05f59b2581f074c756adaee6b260014ac3a0c3ec.tar.gz
Restoring authorship annotation for <sergey@yandex-team.ru>. Commit 2 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 657ec2e45e..d5821304ce 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();