aboutsummaryrefslogtreecommitdiffstats
path: root/src/crc32.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2007-05-31 03:25:19 +0000
committerlloyd <[email protected]>2007-05-31 03:25:19 +0000
commit55608e7dd1aa593944f967f2549564e4f42b654e (patch)
treeec2ec03a762a6dac82eb608487d5394370135624 /src/crc32.cpp
parent22ecdc45a0efa4c444d0b7010b7cd743aeb68c57 (diff)
Write functions to handle loading and saving words a block at a time, taking into
account endian differences. The current code does not take advantage of the knowledge of which endianness we are running on; an optimization suggested by Yves Jerschow is to use (unsafe) casts to speed up the load/store operations. This turns out to provide large performance increases (30% or more) in some cases. Even without the unsafe casts, this version seems to average a few percent faster, probably because the longer loading loops have been partially or fully unrolled. This also makes the code implementing low-level algorithms like ciphers and hashes a bit more succint.
Diffstat (limited to 'src/crc32.cpp')
-rw-r--r--src/crc32.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/crc32.cpp b/src/crc32.cpp
index b10a2eebe..e897cbc02 100644
--- a/src/crc32.cpp
+++ b/src/crc32.cpp
@@ -93,8 +93,7 @@ void CRC32::add_data(const byte input[], u32bit length)
void CRC32::final_result(byte output[])
{
crc ^= 0xFFFFFFFF;
- for(u32bit j = 0; j != 4; ++j)
- output[j] = get_byte(j, crc);
+ store_be(crc, output);
clear();
}