From 05464fa7f99ce2bb76762bf00cc18be3f7ff33f1 Mon Sep 17 00:00:00 2001 From: Amlal Date: Thu, 20 Feb 2025 14:58:19 +0100 Subject: Tweaks and Fixes to CRC and AHCI. Signed-off-by: Amlal --- dev/Kernel/src/Crc32.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'dev/Kernel/src') diff --git a/dev/Kernel/src/Crc32.cc b/dev/Kernel/src/Crc32.cc index bbc0f9bf..98821602 100644 --- a/dev/Kernel/src/Crc32.cc +++ b/dev/Kernel/src/Crc32.cc @@ -69,15 +69,14 @@ namespace NeOS /// @brief Calculate CRC32 of p /// @param p the data to compute. /// @param len the length of the data. - /// @return the CRC32. - UInt ke_calculate_crc32(const Char* p, UInt len) noexcept + /// @return CRC32 of **p**. + UInt32 ke_calculate_crc32(const Char* p, Int32 len) noexcept { - UInt crc = 0xffffffff; + UInt32 crc = 0xffffffff; - while (len-- != 0) + while (--len > 0) crc = kCrcTbl[((UInt8)crc ^ *(p++))] ^ (crc >> 8); - // return (~crc); also works, does the same thing. - return (crc ^ 0xffffffff); + return ~crc; } } // namespace NeOS -- cgit v1.2.3