CRC32 functions in libbb

Rob Sullivan cogito.ergo.cogito at gmail.com
Sun Apr 9 11:20:39 UTC 2006


Size results:
After implementing the use of bb_crc32_filltable in decompress_bunzip2.c and
gzip.c, there didn't appear to be any change in size. I then replaced the
gzip.c CRC code with a call to bb_crc32_calc, which resulted in a size
decrease of 4 bytes.
The only problem is that the way CRC calculation is implemented in
read_bunzip in decompress_bunzip2.c doesn't easily allow itself to be
replaced by a library call - it's intermingled with decompression code
within a loop that gradually supplies data, whereas the bb_crc32_calc
function calculates the CRC of all the data straight away. If I adapted
bb_crc32_calc so that it could be supplied with data gradually, there really
would be very little point in having a function call at all, as the function
would only be around two lines long.

Nevertheless, there is a slight size decrease, and I think that having
crc32.c separately makes CRC implementation a little cleaner in Busybox
generally. In view of implementation "niceness", even just having a separate
bb_crc32_filltable would be good, despite no reduction in size, as it avoids
code in triplicate (bunzip2, gzip, cksum).

Of course, I could be seeing all this through the rose-coloured glasses of
the coder...

Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.busybox.net/pipermail/busybox/attachments/20060409/c89155fb/attachment-0001.htm 


More information about the busybox mailing list