diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:15 +0300 |
commit | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch) | |
tree | da2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /library/cpp/digest/old_crc | |
parent | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff) | |
download | ydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/digest/old_crc')
-rw-r--r-- | library/cpp/digest/old_crc/crc.cpp | 524 | ||||
-rw-r--r-- | library/cpp/digest/old_crc/crc.h | 84 | ||||
-rw-r--r-- | library/cpp/digest/old_crc/crc_ut.cpp | 144 | ||||
-rw-r--r-- | library/cpp/digest/old_crc/gencrc/main.cpp | 46 | ||||
-rw-r--r-- | library/cpp/digest/old_crc/gencrc/ya.make | 18 | ||||
-rw-r--r-- | library/cpp/digest/old_crc/ut/ya.make | 14 | ||||
-rw-r--r-- | library/cpp/digest/old_crc/ya.make | 18 |
7 files changed, 424 insertions, 424 deletions
diff --git a/library/cpp/digest/old_crc/crc.cpp b/library/cpp/digest/old_crc/crc.cpp index 994755f34d..08032a89db 100644 --- a/library/cpp/digest/old_crc/crc.cpp +++ b/library/cpp/digest/old_crc/crc.cpp @@ -1,268 +1,268 @@ -#include "crc.h" +#include "crc.h" #include <library/cpp/digest/old_crc/crc.inc> -#include <util/system/defaults.h> - +#include <util/system/defaults.h> + static const ui64 CRCTAB64[256] = { - ULL(0x0000000000000000), - ULL(0xE543279765927881), - ULL(0x2FC568B9AEB68983), - ULL(0xCA864F2ECB24F102), - ULL(0x5F8AD1735D6D1306), - ULL(0xBAC9F6E438FF6B87), - ULL(0x704FB9CAF3DB9A85), - ULL(0x950C9E5D9649E204), - ULL(0xBF15A2E6BADA260C), - ULL(0x5A568571DF485E8D), - ULL(0x90D0CA5F146CAF8F), - ULL(0x7593EDC871FED70E), - ULL(0xE09F7395E7B7350A), - ULL(0x05DC540282254D8B), - ULL(0xCF5A1B2C4901BC89), - ULL(0x2A193CBB2C93C408), - ULL(0x9B68625A10263499), - ULL(0x7E2B45CD75B44C18), - ULL(0xB4AD0AE3BE90BD1A), - ULL(0x51EE2D74DB02C59B), - ULL(0xC4E2B3294D4B279F), - ULL(0x21A194BE28D95F1E), - ULL(0xEB27DB90E3FDAE1C), - ULL(0x0E64FC07866FD69D), - ULL(0x247DC0BCAAFC1295), - ULL(0xC13EE72BCF6E6A14), - ULL(0x0BB8A805044A9B16), - ULL(0xEEFB8F9261D8E397), - ULL(0x7BF711CFF7910193), - ULL(0x9EB4365892037912), - ULL(0x5432797659278810), - ULL(0xB1715EE13CB5F091), - ULL(0xD393E32345DE11B3), - ULL(0x36D0C4B4204C6932), - ULL(0xFC568B9AEB689830), - ULL(0x1915AC0D8EFAE0B1), - ULL(0x8C19325018B302B5), - ULL(0x695A15C77D217A34), - ULL(0xA3DC5AE9B6058B36), - ULL(0x469F7D7ED397F3B7), - ULL(0x6C8641C5FF0437BF), - ULL(0x89C566529A964F3E), - ULL(0x4343297C51B2BE3C), - ULL(0xA6000EEB3420C6BD), - ULL(0x330C90B6A26924B9), - ULL(0xD64FB721C7FB5C38), - ULL(0x1CC9F80F0CDFAD3A), - ULL(0xF98ADF98694DD5BB), - ULL(0x48FB817955F8252A), - ULL(0xADB8A6EE306A5DAB), - ULL(0x673EE9C0FB4EACA9), - ULL(0x827DCE579EDCD428), - ULL(0x1771500A0895362C), - ULL(0xF232779D6D074EAD), - ULL(0x38B438B3A623BFAF), - ULL(0xDDF71F24C3B1C72E), - ULL(0xF7EE239FEF220326), - ULL(0x12AD04088AB07BA7), - ULL(0xD82B4B2641948AA5), - ULL(0x3D686CB12406F224), - ULL(0xA864F2ECB24F1020), - ULL(0x4D27D57BD7DD68A1), - ULL(0x87A19A551CF999A3), - ULL(0x62E2BDC2796BE122), - ULL(0x4264E1D1EE2E5BE7), - ULL(0xA727C6468BBC2366), - ULL(0x6DA189684098D264), - ULL(0x88E2AEFF250AAAE5), - ULL(0x1DEE30A2B34348E1), - ULL(0xF8AD1735D6D13060), - ULL(0x322B581B1DF5C162), - ULL(0xD7687F8C7867B9E3), - ULL(0xFD71433754F47DEB), - ULL(0x183264A03166056A), - ULL(0xD2B42B8EFA42F468), - ULL(0x37F70C199FD08CE9), - ULL(0xA2FB924409996EED), - ULL(0x47B8B5D36C0B166C), - ULL(0x8D3EFAFDA72FE76E), - ULL(0x687DDD6AC2BD9FEF), - ULL(0xD90C838BFE086F7E), - ULL(0x3C4FA41C9B9A17FF), - ULL(0xF6C9EB3250BEE6FD), - ULL(0x138ACCA5352C9E7C), - ULL(0x868652F8A3657C78), - ULL(0x63C5756FC6F704F9), - ULL(0xA9433A410DD3F5FB), - ULL(0x4C001DD668418D7A), - ULL(0x6619216D44D24972), - ULL(0x835A06FA214031F3), - ULL(0x49DC49D4EA64C0F1), - ULL(0xAC9F6E438FF6B870), - ULL(0x3993F01E19BF5A74), - ULL(0xDCD0D7897C2D22F5), - ULL(0x165698A7B709D3F7), - ULL(0xF315BF30D29BAB76), - ULL(0x91F702F2ABF04A54), - ULL(0x74B42565CE6232D5), - ULL(0xBE326A4B0546C3D7), - ULL(0x5B714DDC60D4BB56), - ULL(0xCE7DD381F69D5952), - ULL(0x2B3EF416930F21D3), - ULL(0xE1B8BB38582BD0D1), - ULL(0x04FB9CAF3DB9A850), - ULL(0x2EE2A014112A6C58), - ULL(0xCBA1878374B814D9), - ULL(0x0127C8ADBF9CE5DB), - ULL(0xE464EF3ADA0E9D5A), - ULL(0x716871674C477F5E), - ULL(0x942B56F029D507DF), - ULL(0x5EAD19DEE2F1F6DD), - ULL(0xBBEE3E4987638E5C), - ULL(0x0A9F60A8BBD67ECD), - ULL(0xEFDC473FDE44064C), - ULL(0x255A08111560F74E), - ULL(0xC0192F8670F28FCF), - ULL(0x5515B1DBE6BB6DCB), - ULL(0xB056964C8329154A), - ULL(0x7AD0D962480DE448), - ULL(0x9F93FEF52D9F9CC9), - ULL(0xB58AC24E010C58C1), - ULL(0x50C9E5D9649E2040), - ULL(0x9A4FAAF7AFBAD142), - ULL(0x7F0C8D60CA28A9C3), - ULL(0xEA00133D5C614BC7), - ULL(0x0F4334AA39F33346), - ULL(0xC5C57B84F2D7C244), - ULL(0x20865C139745BAC5), - ULL(0x84C9C3A3DC5CB7CE), - ULL(0x618AE434B9CECF4F), - ULL(0xAB0CAB1A72EA3E4D), - ULL(0x4E4F8C8D177846CC), - ULL(0xDB4312D08131A4C8), - ULL(0x3E003547E4A3DC49), - ULL(0xF4867A692F872D4B), - ULL(0x11C55DFE4A1555CA), - ULL(0x3BDC6145668691C2), - ULL(0xDE9F46D20314E943), - ULL(0x141909FCC8301841), - ULL(0xF15A2E6BADA260C0), - ULL(0x6456B0363BEB82C4), - ULL(0x811597A15E79FA45), - ULL(0x4B93D88F955D0B47), - ULL(0xAED0FF18F0CF73C6), - ULL(0x1FA1A1F9CC7A8357), - ULL(0xFAE2866EA9E8FBD6), - ULL(0x3064C94062CC0AD4), - ULL(0xD527EED7075E7255), - ULL(0x402B708A91179051), - ULL(0xA568571DF485E8D0), - ULL(0x6FEE18333FA119D2), - ULL(0x8AAD3FA45A336153), - ULL(0xA0B4031F76A0A55B), - ULL(0x45F724881332DDDA), - ULL(0x8F716BA6D8162CD8), - ULL(0x6A324C31BD845459), - ULL(0xFF3ED26C2BCDB65D), - ULL(0x1A7DF5FB4E5FCEDC), - ULL(0xD0FBBAD5857B3FDE), - ULL(0x35B89D42E0E9475F), - ULL(0x575A20809982A67D), - ULL(0xB2190717FC10DEFC), - ULL(0x789F483937342FFE), - ULL(0x9DDC6FAE52A6577F), - ULL(0x08D0F1F3C4EFB57B), - ULL(0xED93D664A17DCDFA), - ULL(0x2715994A6A593CF8), - ULL(0xC256BEDD0FCB4479), - ULL(0xE84F826623588071), - ULL(0x0D0CA5F146CAF8F0), - ULL(0xC78AEADF8DEE09F2), - ULL(0x22C9CD48E87C7173), - ULL(0xB7C553157E359377), - ULL(0x528674821BA7EBF6), - ULL(0x98003BACD0831AF4), - ULL(0x7D431C3BB5116275), - ULL(0xCC3242DA89A492E4), - ULL(0x2971654DEC36EA65), - ULL(0xE3F72A6327121B67), - ULL(0x06B40DF4428063E6), - ULL(0x93B893A9D4C981E2), - ULL(0x76FBB43EB15BF963), - ULL(0xBC7DFB107A7F0861), - ULL(0x593EDC871FED70E0), - ULL(0x7327E03C337EB4E8), - ULL(0x9664C7AB56ECCC69), - ULL(0x5CE288859DC83D6B), - ULL(0xB9A1AF12F85A45EA), - ULL(0x2CAD314F6E13A7EE), - ULL(0xC9EE16D80B81DF6F), - ULL(0x036859F6C0A52E6D), - ULL(0xE62B7E61A53756EC), - ULL(0xC6AD22723272EC29), - ULL(0x23EE05E557E094A8), - ULL(0xE9684ACB9CC465AA), - ULL(0x0C2B6D5CF9561D2B), - ULL(0x9927F3016F1FFF2F), - ULL(0x7C64D4960A8D87AE), - ULL(0xB6E29BB8C1A976AC), - ULL(0x53A1BC2FA43B0E2D), - ULL(0x79B8809488A8CA25), - ULL(0x9CFBA703ED3AB2A4), - ULL(0x567DE82D261E43A6), - ULL(0xB33ECFBA438C3B27), - ULL(0x263251E7D5C5D923), - ULL(0xC3717670B057A1A2), - ULL(0x09F7395E7B7350A0), - ULL(0xECB41EC91EE12821), - ULL(0x5DC540282254D8B0), - ULL(0xB88667BF47C6A031), - ULL(0x720028918CE25133), - ULL(0x97430F06E97029B2), - ULL(0x024F915B7F39CBB6), - ULL(0xE70CB6CC1AABB337), - ULL(0x2D8AF9E2D18F4235), - ULL(0xC8C9DE75B41D3AB4), - ULL(0xE2D0E2CE988EFEBC), - ULL(0x0793C559FD1C863D), - ULL(0xCD158A773638773F), - ULL(0x2856ADE053AA0FBE), - ULL(0xBD5A33BDC5E3EDBA), - ULL(0x5819142AA071953B), - ULL(0x929F5B046B556439), - ULL(0x77DC7C930EC71CB8), - ULL(0x153EC15177ACFD9A), - ULL(0xF07DE6C6123E851B), - ULL(0x3AFBA9E8D91A7419), - ULL(0xDFB88E7FBC880C98), - ULL(0x4AB410222AC1EE9C), - ULL(0xAFF737B54F53961D), - ULL(0x6571789B8477671F), - ULL(0x80325F0CE1E51F9E), - ULL(0xAA2B63B7CD76DB96), - ULL(0x4F684420A8E4A317), - ULL(0x85EE0B0E63C05215), - ULL(0x60AD2C9906522A94), - ULL(0xF5A1B2C4901BC890), - ULL(0x10E29553F589B011), - ULL(0xDA64DA7D3EAD4113), - ULL(0x3F27FDEA5B3F3992), - ULL(0x8E56A30B678AC903), - ULL(0x6B15849C0218B182), - ULL(0xA193CBB2C93C4080), - ULL(0x44D0EC25ACAE3801), - ULL(0xD1DC72783AE7DA05), - ULL(0x349F55EF5F75A284), - ULL(0xFE191AC194515386), - ULL(0x1B5A3D56F1C32B07), - ULL(0x314301EDDD50EF0F), - ULL(0xD400267AB8C2978E), - ULL(0x1E86695473E6668C), - ULL(0xFBC54EC316741E0D), - ULL(0x6EC9D09E803DFC09), - ULL(0x8B8AF709E5AF8488), - ULL(0x410CB8272E8B758A), - ULL(0xA44F9FB04B190D0B), + ULL(0x0000000000000000), + ULL(0xE543279765927881), + ULL(0x2FC568B9AEB68983), + ULL(0xCA864F2ECB24F102), + ULL(0x5F8AD1735D6D1306), + ULL(0xBAC9F6E438FF6B87), + ULL(0x704FB9CAF3DB9A85), + ULL(0x950C9E5D9649E204), + ULL(0xBF15A2E6BADA260C), + ULL(0x5A568571DF485E8D), + ULL(0x90D0CA5F146CAF8F), + ULL(0x7593EDC871FED70E), + ULL(0xE09F7395E7B7350A), + ULL(0x05DC540282254D8B), + ULL(0xCF5A1B2C4901BC89), + ULL(0x2A193CBB2C93C408), + ULL(0x9B68625A10263499), + ULL(0x7E2B45CD75B44C18), + ULL(0xB4AD0AE3BE90BD1A), + ULL(0x51EE2D74DB02C59B), + ULL(0xC4E2B3294D4B279F), + ULL(0x21A194BE28D95F1E), + ULL(0xEB27DB90E3FDAE1C), + ULL(0x0E64FC07866FD69D), + ULL(0x247DC0BCAAFC1295), + ULL(0xC13EE72BCF6E6A14), + ULL(0x0BB8A805044A9B16), + ULL(0xEEFB8F9261D8E397), + ULL(0x7BF711CFF7910193), + ULL(0x9EB4365892037912), + ULL(0x5432797659278810), + ULL(0xB1715EE13CB5F091), + ULL(0xD393E32345DE11B3), + ULL(0x36D0C4B4204C6932), + ULL(0xFC568B9AEB689830), + ULL(0x1915AC0D8EFAE0B1), + ULL(0x8C19325018B302B5), + ULL(0x695A15C77D217A34), + ULL(0xA3DC5AE9B6058B36), + ULL(0x469F7D7ED397F3B7), + ULL(0x6C8641C5FF0437BF), + ULL(0x89C566529A964F3E), + ULL(0x4343297C51B2BE3C), + ULL(0xA6000EEB3420C6BD), + ULL(0x330C90B6A26924B9), + ULL(0xD64FB721C7FB5C38), + ULL(0x1CC9F80F0CDFAD3A), + ULL(0xF98ADF98694DD5BB), + ULL(0x48FB817955F8252A), + ULL(0xADB8A6EE306A5DAB), + ULL(0x673EE9C0FB4EACA9), + ULL(0x827DCE579EDCD428), + ULL(0x1771500A0895362C), + ULL(0xF232779D6D074EAD), + ULL(0x38B438B3A623BFAF), + ULL(0xDDF71F24C3B1C72E), + ULL(0xF7EE239FEF220326), + ULL(0x12AD04088AB07BA7), + ULL(0xD82B4B2641948AA5), + ULL(0x3D686CB12406F224), + ULL(0xA864F2ECB24F1020), + ULL(0x4D27D57BD7DD68A1), + ULL(0x87A19A551CF999A3), + ULL(0x62E2BDC2796BE122), + ULL(0x4264E1D1EE2E5BE7), + ULL(0xA727C6468BBC2366), + ULL(0x6DA189684098D264), + ULL(0x88E2AEFF250AAAE5), + ULL(0x1DEE30A2B34348E1), + ULL(0xF8AD1735D6D13060), + ULL(0x322B581B1DF5C162), + ULL(0xD7687F8C7867B9E3), + ULL(0xFD71433754F47DEB), + ULL(0x183264A03166056A), + ULL(0xD2B42B8EFA42F468), + ULL(0x37F70C199FD08CE9), + ULL(0xA2FB924409996EED), + ULL(0x47B8B5D36C0B166C), + ULL(0x8D3EFAFDA72FE76E), + ULL(0x687DDD6AC2BD9FEF), + ULL(0xD90C838BFE086F7E), + ULL(0x3C4FA41C9B9A17FF), + ULL(0xF6C9EB3250BEE6FD), + ULL(0x138ACCA5352C9E7C), + ULL(0x868652F8A3657C78), + ULL(0x63C5756FC6F704F9), + ULL(0xA9433A410DD3F5FB), + ULL(0x4C001DD668418D7A), + ULL(0x6619216D44D24972), + ULL(0x835A06FA214031F3), + ULL(0x49DC49D4EA64C0F1), + ULL(0xAC9F6E438FF6B870), + ULL(0x3993F01E19BF5A74), + ULL(0xDCD0D7897C2D22F5), + ULL(0x165698A7B709D3F7), + ULL(0xF315BF30D29BAB76), + ULL(0x91F702F2ABF04A54), + ULL(0x74B42565CE6232D5), + ULL(0xBE326A4B0546C3D7), + ULL(0x5B714DDC60D4BB56), + ULL(0xCE7DD381F69D5952), + ULL(0x2B3EF416930F21D3), + ULL(0xE1B8BB38582BD0D1), + ULL(0x04FB9CAF3DB9A850), + ULL(0x2EE2A014112A6C58), + ULL(0xCBA1878374B814D9), + ULL(0x0127C8ADBF9CE5DB), + ULL(0xE464EF3ADA0E9D5A), + ULL(0x716871674C477F5E), + ULL(0x942B56F029D507DF), + ULL(0x5EAD19DEE2F1F6DD), + ULL(0xBBEE3E4987638E5C), + ULL(0x0A9F60A8BBD67ECD), + ULL(0xEFDC473FDE44064C), + ULL(0x255A08111560F74E), + ULL(0xC0192F8670F28FCF), + ULL(0x5515B1DBE6BB6DCB), + ULL(0xB056964C8329154A), + ULL(0x7AD0D962480DE448), + ULL(0x9F93FEF52D9F9CC9), + ULL(0xB58AC24E010C58C1), + ULL(0x50C9E5D9649E2040), + ULL(0x9A4FAAF7AFBAD142), + ULL(0x7F0C8D60CA28A9C3), + ULL(0xEA00133D5C614BC7), + ULL(0x0F4334AA39F33346), + ULL(0xC5C57B84F2D7C244), + ULL(0x20865C139745BAC5), + ULL(0x84C9C3A3DC5CB7CE), + ULL(0x618AE434B9CECF4F), + ULL(0xAB0CAB1A72EA3E4D), + ULL(0x4E4F8C8D177846CC), + ULL(0xDB4312D08131A4C8), + ULL(0x3E003547E4A3DC49), + ULL(0xF4867A692F872D4B), + ULL(0x11C55DFE4A1555CA), + ULL(0x3BDC6145668691C2), + ULL(0xDE9F46D20314E943), + ULL(0x141909FCC8301841), + ULL(0xF15A2E6BADA260C0), + ULL(0x6456B0363BEB82C4), + ULL(0x811597A15E79FA45), + ULL(0x4B93D88F955D0B47), + ULL(0xAED0FF18F0CF73C6), + ULL(0x1FA1A1F9CC7A8357), + ULL(0xFAE2866EA9E8FBD6), + ULL(0x3064C94062CC0AD4), + ULL(0xD527EED7075E7255), + ULL(0x402B708A91179051), + ULL(0xA568571DF485E8D0), + ULL(0x6FEE18333FA119D2), + ULL(0x8AAD3FA45A336153), + ULL(0xA0B4031F76A0A55B), + ULL(0x45F724881332DDDA), + ULL(0x8F716BA6D8162CD8), + ULL(0x6A324C31BD845459), + ULL(0xFF3ED26C2BCDB65D), + ULL(0x1A7DF5FB4E5FCEDC), + ULL(0xD0FBBAD5857B3FDE), + ULL(0x35B89D42E0E9475F), + ULL(0x575A20809982A67D), + ULL(0xB2190717FC10DEFC), + ULL(0x789F483937342FFE), + ULL(0x9DDC6FAE52A6577F), + ULL(0x08D0F1F3C4EFB57B), + ULL(0xED93D664A17DCDFA), + ULL(0x2715994A6A593CF8), + ULL(0xC256BEDD0FCB4479), + ULL(0xE84F826623588071), + ULL(0x0D0CA5F146CAF8F0), + ULL(0xC78AEADF8DEE09F2), + ULL(0x22C9CD48E87C7173), + ULL(0xB7C553157E359377), + ULL(0x528674821BA7EBF6), + ULL(0x98003BACD0831AF4), + ULL(0x7D431C3BB5116275), + ULL(0xCC3242DA89A492E4), + ULL(0x2971654DEC36EA65), + ULL(0xE3F72A6327121B67), + ULL(0x06B40DF4428063E6), + ULL(0x93B893A9D4C981E2), + ULL(0x76FBB43EB15BF963), + ULL(0xBC7DFB107A7F0861), + ULL(0x593EDC871FED70E0), + ULL(0x7327E03C337EB4E8), + ULL(0x9664C7AB56ECCC69), + ULL(0x5CE288859DC83D6B), + ULL(0xB9A1AF12F85A45EA), + ULL(0x2CAD314F6E13A7EE), + ULL(0xC9EE16D80B81DF6F), + ULL(0x036859F6C0A52E6D), + ULL(0xE62B7E61A53756EC), + ULL(0xC6AD22723272EC29), + ULL(0x23EE05E557E094A8), + ULL(0xE9684ACB9CC465AA), + ULL(0x0C2B6D5CF9561D2B), + ULL(0x9927F3016F1FFF2F), + ULL(0x7C64D4960A8D87AE), + ULL(0xB6E29BB8C1A976AC), + ULL(0x53A1BC2FA43B0E2D), + ULL(0x79B8809488A8CA25), + ULL(0x9CFBA703ED3AB2A4), + ULL(0x567DE82D261E43A6), + ULL(0xB33ECFBA438C3B27), + ULL(0x263251E7D5C5D923), + ULL(0xC3717670B057A1A2), + ULL(0x09F7395E7B7350A0), + ULL(0xECB41EC91EE12821), + ULL(0x5DC540282254D8B0), + ULL(0xB88667BF47C6A031), + ULL(0x720028918CE25133), + ULL(0x97430F06E97029B2), + ULL(0x024F915B7F39CBB6), + ULL(0xE70CB6CC1AABB337), + ULL(0x2D8AF9E2D18F4235), + ULL(0xC8C9DE75B41D3AB4), + ULL(0xE2D0E2CE988EFEBC), + ULL(0x0793C559FD1C863D), + ULL(0xCD158A773638773F), + ULL(0x2856ADE053AA0FBE), + ULL(0xBD5A33BDC5E3EDBA), + ULL(0x5819142AA071953B), + ULL(0x929F5B046B556439), + ULL(0x77DC7C930EC71CB8), + ULL(0x153EC15177ACFD9A), + ULL(0xF07DE6C6123E851B), + ULL(0x3AFBA9E8D91A7419), + ULL(0xDFB88E7FBC880C98), + ULL(0x4AB410222AC1EE9C), + ULL(0xAFF737B54F53961D), + ULL(0x6571789B8477671F), + ULL(0x80325F0CE1E51F9E), + ULL(0xAA2B63B7CD76DB96), + ULL(0x4F684420A8E4A317), + ULL(0x85EE0B0E63C05215), + ULL(0x60AD2C9906522A94), + ULL(0xF5A1B2C4901BC890), + ULL(0x10E29553F589B011), + ULL(0xDA64DA7D3EAD4113), + ULL(0x3F27FDEA5B3F3992), + ULL(0x8E56A30B678AC903), + ULL(0x6B15849C0218B182), + ULL(0xA193CBB2C93C4080), + ULL(0x44D0EC25ACAE3801), + ULL(0xD1DC72783AE7DA05), + ULL(0x349F55EF5F75A284), + ULL(0xFE191AC194515386), + ULL(0x1B5A3D56F1C32B07), + ULL(0x314301EDDD50EF0F), + ULL(0xD400267AB8C2978E), + ULL(0x1E86695473E6668C), + ULL(0xFBC54EC316741E0D), + ULL(0x6EC9D09E803DFC09), + ULL(0x8B8AF709E5AF8488), + ULL(0x410CB8272E8B758A), + ULL(0xA44F9FB04B190D0B), }; -const ui32* crctab16 = CRCTAB16; -const ui32* crctab32 = CRCTAB32; -const ui64* crctab64 = CRCTAB64; +const ui32* crctab16 = CRCTAB16; +const ui32* crctab32 = CRCTAB32; +const ui64* crctab64 = CRCTAB64; diff --git a/library/cpp/digest/old_crc/crc.h b/library/cpp/digest/old_crc/crc.h index 4a3ce6d05e..e7da8967a8 100644 --- a/library/cpp/digest/old_crc/crc.h +++ b/library/cpp/digest/old_crc/crc.h @@ -7,19 +7,19 @@ #define CRC64INIT ULL(0xFFFFFFFFFFFFFFFF) // CCITT CRC-16 -inline ui16 crc16(const char* buf, size_t buflen, ui32 crcinit = CRC16INIT) { +inline ui16 crc16(const char* buf, size_t buflen, ui32 crcinit = CRC16INIT) { ui32 crc = 0xFFFF & ((crcinit >> 8) ^ (crcinit << 8)); - const char* end = buf + buflen; - extern const ui32* crctab16; + const char* end = buf + buflen; + extern const ui32* crctab16; while (buf < end) { crc = (crc >> 8) ^ crctab16[(crc ^ *buf) & 0xFF]; ++buf; } - return (ui16)(0xFFFF & ((crc >> 8) ^ (crc << 8))); + return (ui16)(0xFFFF & ((crc >> 8) ^ (crc << 8))); } -struct IdTR { +struct IdTR { Y_FORCE_INLINE static ui8 T(ui8 a) { return a; } @@ -27,31 +27,31 @@ struct IdTR { // CCITT CRC-32 template <class TR> -inline ui32 crc32(const char* buf, size_t buflen, ui32 crcinit = CRC32INIT) { +inline ui32 crc32(const char* buf, size_t buflen, ui32 crcinit = CRC32INIT) { ui32 crc = crcinit ^ 0xFFFFFFFF; - const char* end = buf + buflen; - extern const ui32* crctab32; + const char* end = buf + buflen; + extern const ui32* crctab32; - while (buf < end) { + while (buf < end) { crc = (crc >> 8) ^ crctab32[(crc ^ TR::T((ui8)*buf)) & 0xFF]; ++buf; } - + return crc ^ 0xFFFFFFFF; } -inline ui32 crc32(const char* buf, size_t buflen, ui32 crcinit = CRC32INIT) { +inline ui32 crc32(const char* buf, size_t buflen, ui32 crcinit = CRC32INIT) { return crc32<IdTR>(buf, buflen, crcinit); } -inline ui32 crc32(const void* buf, size_t buflen, ui32 crcinit = CRC32INIT) { - return crc32((const char*)buf, buflen, crcinit); +inline ui32 crc32(const void* buf, size_t buflen, ui32 crcinit = CRC32INIT) { + return crc32((const char*)buf, buflen, crcinit); } // Copyright (C) Sewell Development Corporation, 1994 - 1998. -inline ui64 crc64(const void* buf, size_t buflen, ui64 crcinit = CRC64INIT) { - const unsigned char* ptr = (const unsigned char*)buf; - extern const ui64* crctab64; +inline ui64 crc64(const void* buf, size_t buflen, ui64 crcinit = CRC64INIT) { + const unsigned char* ptr = (const unsigned char*)buf; + extern const ui64* crctab64; while (buflen--) { crcinit = crctab64[((crcinit >> 56) ^ *ptr++)] ^ (crcinit << 8); @@ -59,32 +59,32 @@ inline ui64 crc64(const void* buf, size_t buflen, ui64 crcinit = CRC64INIT) { return crcinit; } -namespace NCrcPrivate { - template <unsigned N> - struct TCrcHelper; - -#define DEF_CRC_FUNC(t) \ - template <> \ - struct TCrcHelper<t> { \ - static const ui##t Init = CRC##t##INIT; \ - static inline ui##t Crc(const void* buf, size_t buflen, ui##t crcinit) { \ - return crc##t((const char*)buf, buflen, crcinit); \ - } \ - }; - - DEF_CRC_FUNC(16) - DEF_CRC_FUNC(32) - DEF_CRC_FUNC(64) - -#undef DEF_CRC_FUNC -} - +namespace NCrcPrivate { + template <unsigned N> + struct TCrcHelper; + +#define DEF_CRC_FUNC(t) \ + template <> \ + struct TCrcHelper<t> { \ + static const ui##t Init = CRC##t##INIT; \ + static inline ui##t Crc(const void* buf, size_t buflen, ui##t crcinit) { \ + return crc##t((const char*)buf, buflen, crcinit); \ + } \ + }; + + DEF_CRC_FUNC(16) + DEF_CRC_FUNC(32) + DEF_CRC_FUNC(64) + +#undef DEF_CRC_FUNC +} + template <class T> -static inline T Crc(const void* buf, size_t len, T init) { - return (T)NCrcPrivate::TCrcHelper<8 * sizeof(T)>::Crc(buf, len, init); +static inline T Crc(const void* buf, size_t len, T init) { + return (T)NCrcPrivate::TCrcHelper<8 * sizeof(T)>::Crc(buf, len, init); } -template <class T> -static inline T Crc(const void* buf, size_t len) { - return Crc<T>(buf, len, (T)NCrcPrivate::TCrcHelper<8 * sizeof(T)>::Init); -} +template <class T> +static inline T Crc(const void* buf, size_t len) { + return Crc<T>(buf, len, (T)NCrcPrivate::TCrcHelper<8 * sizeof(T)>::Init); +} diff --git a/library/cpp/digest/old_crc/crc_ut.cpp b/library/cpp/digest/old_crc/crc_ut.cpp index 46e1d5d29b..6bf2a12294 100644 --- a/library/cpp/digest/old_crc/crc_ut.cpp +++ b/library/cpp/digest/old_crc/crc_ut.cpp @@ -1,74 +1,74 @@ -#include "crc.h" - +#include "crc.h" + #include <library/cpp/testing/unittest/registar.h> - + #include <util/stream/output.h> - -class TCrcTest: public TTestBase { - UNIT_TEST_SUITE(TCrcTest); - UNIT_TEST(TestCrc16) - UNIT_TEST(TestCrc32) - UNIT_TEST(TestCrc64) - UNIT_TEST_SUITE_END(); - -private: - inline void TestCrc16() { - const ui16 expected[] = { - 41719, - 57001, - 53722, - 3276}; - - Run<ui16>(expected); - } - - inline void TestCrc32() { - const ui32 expected[] = { - 688229491UL, - 3543112608UL, - 4127534015UL, - 3009909774UL}; - - Run<ui32>(expected); - } - - inline void TestCrc64() { - const ui64 expected[] = { - 12116107829328640258ULL, - 18186277744016380552ULL, - 249923753044811734ULL, - 7852471725963920356ULL}; - - Run<ui64>(expected); - } - -private: - template <class T> - inline void Run(const T* expected) { - ui8 buf[256]; - - for (size_t i = 0; i < 256; ++i) { - buf[i] = i; - } - - Test<T>(buf, 256, expected[0]); - Test<T>(buf, 255, expected[1]); - Test<T>(buf, 254, expected[2]); - Test<T>(buf, 253, expected[3]); - } - - template <class T> - inline void Test(const void* data, size_t len, T expected) { - const T res = Crc<T>(data, len); - - try { - UNIT_ASSERT_EQUAL(res, expected); - } catch (...) { - Cerr << res << Endl; - - throw; - } - } -}; - -UNIT_TEST_SUITE_REGISTRATION(TCrcTest); + +class TCrcTest: public TTestBase { + UNIT_TEST_SUITE(TCrcTest); + UNIT_TEST(TestCrc16) + UNIT_TEST(TestCrc32) + UNIT_TEST(TestCrc64) + UNIT_TEST_SUITE_END(); + +private: + inline void TestCrc16() { + const ui16 expected[] = { + 41719, + 57001, + 53722, + 3276}; + + Run<ui16>(expected); + } + + inline void TestCrc32() { + const ui32 expected[] = { + 688229491UL, + 3543112608UL, + 4127534015UL, + 3009909774UL}; + + Run<ui32>(expected); + } + + inline void TestCrc64() { + const ui64 expected[] = { + 12116107829328640258ULL, + 18186277744016380552ULL, + 249923753044811734ULL, + 7852471725963920356ULL}; + + Run<ui64>(expected); + } + +private: + template <class T> + inline void Run(const T* expected) { + ui8 buf[256]; + + for (size_t i = 0; i < 256; ++i) { + buf[i] = i; + } + + Test<T>(buf, 256, expected[0]); + Test<T>(buf, 255, expected[1]); + Test<T>(buf, 254, expected[2]); + Test<T>(buf, 253, expected[3]); + } + + template <class T> + inline void Test(const void* data, size_t len, T expected) { + const T res = Crc<T>(data, len); + + try { + UNIT_ASSERT_EQUAL(res, expected); + } catch (...) { + Cerr << res << Endl; + + throw; + } + } +}; + +UNIT_TEST_SUITE_REGISTRATION(TCrcTest); diff --git a/library/cpp/digest/old_crc/gencrc/main.cpp b/library/cpp/digest/old_crc/gencrc/main.cpp index d5821304ce..e3fe9e04ce 100644 --- a/library/cpp/digest/old_crc/gencrc/main.cpp +++ b/library/cpp/digest/old_crc/gencrc/main.cpp @@ -4,29 +4,29 @@ #define POLY_32 0xEDB88320UL #define POLY_64 ULL(0xE543279765927881) -static void crc16init() { - ui32 CRCTAB16[256]; +static void crc16init() { + ui32 CRCTAB16[256]; ui32 crc; int i, j; - for (i = 0; i < 256; CRCTAB16[i++] = 0xFFFF & ((crc << 8) ^ (crc >> 8))) + 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 (size_t k = 0; k < 256; ++k) { Cout << " ULL(" << CRCTAB16[k] << ")"; - + if (k != 255) { - Cout << ",\n"; - } - } + Cout << ",\n"; + } + } } -static void crc32init() { - ui32 CRCTAB32[256]; +static void crc32init() { + ui32 CRCTAB32[256]; ui32 crc; int i, j; @@ -36,21 +36,21 @@ static void crc32init() { crc = (crc >> 1) ^ POLY_32; else crc >>= 1; - + for (size_t k = 0; k < 256; ++k) { Cout << " ULL(" << CRCTAB32[k] << ")"; - + if (k != 255) { - Cout << ",\n"; - } - } + Cout << ",\n"; + } + } } -int main() { - Cout << "static const ui32 CRCTAB16[] = {\n\n"; - crc16init(); - Cout << "\n};\n\n"; - Cout << "static const ui32 CRCTAB32[] = {\n\n"; - crc32init(); - Cout << "\n};\n\n"; -} +int main() { + Cout << "static const ui32 CRCTAB16[] = {\n\n"; + crc16init(); + Cout << "\n};\n\n"; + Cout << "static const ui32 CRCTAB32[] = {\n\n"; + crc32init(); + Cout << "\n};\n\n"; +} diff --git a/library/cpp/digest/old_crc/gencrc/ya.make b/library/cpp/digest/old_crc/gencrc/ya.make index df25863bee..4d3a328780 100644 --- a/library/cpp/digest/old_crc/gencrc/ya.make +++ b/library/cpp/digest/old_crc/gencrc/ya.make @@ -1,9 +1,9 @@ -PROGRAM() - -OWNER(pg) - -SRCS( - main.cpp -) - -END() +PROGRAM() + +OWNER(pg) + +SRCS( + main.cpp +) + +END() diff --git a/library/cpp/digest/old_crc/ut/ya.make b/library/cpp/digest/old_crc/ut/ya.make index a783bbae5b..08e432b351 100644 --- a/library/cpp/digest/old_crc/ut/ya.make +++ b/library/cpp/digest/old_crc/ut/ya.make @@ -1,12 +1,12 @@ UNITTEST_FOR(library/cpp/digest/old_crc) - + OWNER( pg g:util ) - -SRCS( - crc_ut.cpp -) - -END() + +SRCS( + crc_ut.cpp +) + +END() diff --git a/library/cpp/digest/old_crc/ya.make b/library/cpp/digest/old_crc/ya.make index aa6ea8f6c5..66eaa0f4ad 100644 --- a/library/cpp/digest/old_crc/ya.make +++ b/library/cpp/digest/old_crc/ya.make @@ -1,17 +1,17 @@ -LIBRARY() - +LIBRARY() + OWNER( pg g:util ) - -SRCS( - crc.cpp -) - + +SRCS( + crc.cpp +) + RUN_PROGRAM( library/cpp/digest/old_crc/gencrc STDOUT crc.inc ) - -END() + +END() |