summaryrefslogtreecommitdiffhomepage
path: root/dev/Kernel/src/Crc32.cc
diff options
context:
space:
mode:
Diffstat (limited to 'dev/Kernel/src/Crc32.cc')
-rw-r--r--dev/Kernel/src/Crc32.cc11
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