From f903069c139df58d1ba855f7cf02c4a2d4e51dc3 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 27 Sep 2016 18:28:55 +0200 Subject: Optimize VersionHash() to not need temporary copy of input Stop copying stuff, and just parse the bytes one by-one to the newly created AddCRC16Byte. This improves the instruction count for an update run from 720,850,121 to 455,801,749 according to callgrind. --- apt-pkg/contrib/crc-16.h | 1 + 1 file changed, 1 insertion(+) (limited to 'apt-pkg/contrib/crc-16.h') diff --git a/apt-pkg/contrib/crc-16.h b/apt-pkg/contrib/crc-16.h index 08acdafb7..6cc3556c6 100644 --- a/apt-pkg/contrib/crc-16.h +++ b/apt-pkg/contrib/crc-16.h @@ -13,6 +13,7 @@ #include #define INIT_FCS 0xffff +unsigned short AddCRC16Byte(unsigned short fcs, unsigned char byte) APT_CONST; unsigned short AddCRC16(unsigned short fcs, void const *buf, unsigned long long len) APT_PURE; -- cgit v1.2.3