summaryrefslogtreecommitdiffhomepage
path: root/Private
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-01 09:40:51 +0100
committerAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-01 09:40:51 +0100
commit6c4cc0dba681fef1cef3c31877653a1d6413fc90 (patch)
tree55d1e1803c1224dba47538042851aa9175064e6c /Private
parenta9222cf9d73734457206f4f9692d699313678159 (diff)
Kernel: Improve CRC compute function.
Signed-off-by: Amlal El Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Private')
-rw-r--r--Private/NewKit/Crc32.hpp (renamed from Private/NewKit/CRC32.hpp)2
-rw-r--r--Private/Source/Crc32.cxx8
2 files changed, 5 insertions, 5 deletions
diff --git a/Private/NewKit/CRC32.hpp b/Private/NewKit/Crc32.hpp
index 15bff9db..7e9ce2af 100644
--- a/Private/NewKit/CRC32.hpp
+++ b/Private/NewKit/Crc32.hpp
@@ -15,7 +15,7 @@
#define kCrcCnt (256)
namespace HCore {
-Int ke_calculate_crc32(const Char* crc, Int len) noexcept;
+UInt ke_calculate_crc32(const Char* crc, UInt len) noexcept;
} // namespace HCore
#endif // !__CRC32_H__
diff --git a/Private/Source/Crc32.cxx b/Private/Source/Crc32.cxx
index 3565b3fc..b451d4d4 100644
--- a/Private/Source/Crc32.cxx
+++ b/Private/Source/Crc32.cxx
@@ -7,7 +7,7 @@
* ========================================================
*/
-#include <NewKit/CRC32.hpp>
+#include <NewKit/Crc32.hpp>
// @file CRC32.cpp
// @brief Checksum implementation.
@@ -58,9 +58,9 @@ UInt kCrcTbl[kCrcCnt] = {
0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d};
-/// @brief calculate CRC32 of series of byte.
-Int ke_calculate_crc32(const Char *p, Int len) noexcept {
- UInt32 crc = 0xffffffff;
+/// @brief calculate CRC32 of pointer.
+UInt ke_calculate_crc32(const Char *p, UInt len) noexcept {
+ UInt crc = 0xffffffff;
while (len-- != 0) crc = kCrcTbl[((UInt8)crc ^ *(p++))] ^ (crc >> 8);