diff options
| author | Amlal <amlal.elmahrouss@icloud.com> | 2025-02-20 14:58:19 +0100 |
|---|---|---|
| committer | Amlal <amlal.elmahrouss@icloud.com> | 2025-02-20 14:58:19 +0100 |
| commit | 05464fa7f99ce2bb76762bf00cc18be3f7ff33f1 (patch) | |
| tree | d2757fc7b707a32fd6d8ecd95e75a68aaed35888 /dev/Kernel/src | |
| parent | 9e7da502e56af32adfcdb0669cee0aab4363b2e1 (diff) | |
Tweaks and Fixes to CRC and AHCI.
Signed-off-by: Amlal <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/Kernel/src')
| -rw-r--r-- | dev/Kernel/src/Crc32.cc | 11 |
1 files changed, 5 insertions, 6 deletions
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 |
