[DragonFlyBSD - Bug #2824] (New) New higher speed CRC code

bugtracker-admin at leaf.dragonflybsd.org bugtracker-admin at leaf.dragonflybsd.org
Tue Jun 9 05:51:22 PDT 2015

Issue #2824 has been reported by robin.carey1.

Bug #2824: New higher speed CRC code

* Author: robin.carey1
* Status: New
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
Dear DragonFlyBSD bugs,

This isn't really a bug. I noticed there is the possibility of improving
the performance of the recently committed new CRC code ("fast iscsi crc

In the following function:


static uint32_t
singletable_crc32c(uint32_t crc, const void *buf, size_t size)
       const uint8_t *p = buf;

       while (size--)
               crc = crc32Table[(crc ^ *p++) & 0xff] ^ (crc >> 8);

       return crc;

The two separate operations of "size--" and "*p++" could be combined into
one operation. The way that I would do that would be something like:

size_t I;
for (i = 0; i < size; ++i) {
  crc = crc32Table[(crc ^ p[i]) & 0xff] ^ (crc >> 8);

So you would be saving one operation; performance improvement.

I haven't looked at the rest of the code, so perhaps there are other
performance improvements that could be had.

Hope this helps ...


Robin Carey BSc

You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account

More information about the Bugs mailing list