From 4e25c13d0839bc0a9b0a5b911cd8d4fadb8dd508 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Mon, 25 Sep 2023 15:04:19 +0200 Subject: [PATCH] hash: macOS support Signed-off-by: Simon Rozman --- UnitTests/UnitTests.xcodeproj/project.pbxproj | 2 ++ UnitTests/main.cpp | 4 ++++ include/stdex/math.hpp | 5 ++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/UnitTests/UnitTests.xcodeproj/project.pbxproj b/UnitTests/UnitTests.xcodeproj/project.pbxproj index b1dd5ed65..c07dec75d 100644 --- a/UnitTests/UnitTests.xcodeproj/project.pbxproj +++ b/UnitTests/UnitTests.xcodeproj/project.pbxproj @@ -46,6 +46,7 @@ F4213D2A2ABB14C600F72674 /* sgml_unicode.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = sgml_unicode.hpp; path = ../include/stdex/sgml_unicode.hpp; sourceTree = ""; }; F4213D2B2ABB14C600F72674 /* sgml.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = sgml.hpp; path = ../include/stdex/sgml.hpp; sourceTree = ""; }; F4213D2C2ABB14C600F72674 /* system.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = system.hpp; path = ../include/stdex/system.hpp; sourceTree = ""; }; + F437AA902AC1BB64001E2230 /* hash.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = hash.cpp; sourceTree = ""; }; F4B7FBDC2AAF49BC00C6BE9F /* UnitTests */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = UnitTests; sourceTree = BUILT_PRODUCTS_DIR; }; F4C07F4E2AB059300044EDC0 /* math.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = math.cpp; sourceTree = ""; }; F4C07F502AB059580044EDC0 /* pch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pch.h; sourceTree = ""; }; @@ -103,6 +104,7 @@ isa = PBXGroup; children = ( F4C07F532AB05A240044EDC0 /* compat.hpp */, + F437AA902AC1BB64001E2230 /* hash.cpp */, F4C07F542AB05B5B0044EDC0 /* main.cpp */, F4C07F4E2AB059300044EDC0 /* math.cpp */, F4C07F562AB08E690044EDC0 /* parser.cpp */, diff --git a/UnitTests/main.cpp b/UnitTests/main.cpp index 9d4a69deb..681ab2ff5 100644 --- a/UnitTests/main.cpp +++ b/UnitTests/main.cpp @@ -4,6 +4,7 @@ */ #include "pch.h" +#include "hash.cpp" #include "math.cpp" #include "parser.cpp" #include "ring.cpp" @@ -15,6 +16,9 @@ int main(int argc, const char * argv[]) { try { + UnitTests::hash::crc32(); + UnitTests::hash::md5(); + UnitTests::hash::sha1(); UnitTests::math::mul(); UnitTests::math::add(); UnitTests::parser::wtest(); diff --git a/include/stdex/math.hpp b/include/stdex/math.hpp index 2f5641b44..30b9d3e68 100644 --- a/include/stdex/math.hpp +++ b/include/stdex/math.hpp @@ -77,8 +77,7 @@ namespace stdex #ifdef _WIN32 return _rotl(value, bits); #else - return __rold(value, bits); - // return (value << bits) | (value >> (32 - bits)); + return (value << bits) | (value >> (32 - bits)); #endif } -} \ No newline at end of file +}