• Andrew Morton's avatar
    [PATCH] crc32 optimizations · 36303df0
    Andrew Morton authored
    Patch from Joakim Tjernlund <joakim.tjernlund@lumentis.se>
    
    Here is another update(against BK curr) for crc32(). A kind soul pointed out
    the optimizations below.
    
    lib/crc32defs.h:
     - Make it possible to define new values for CRC_LE_BITS/CRC_BE_BITS without
       modifying the source.
    
    lib/crc32.c:
     - Eliminate the need for ENDIAN_SHIFT. Saves a 24 bit shift in the byte
       loops.
    
     - Swap the XOR expression in DO_CRC. gcc for x86 can not do that simple
       optimization itself(gcc 3.2.2 and RH gcc 2.96 tested). Will improve
       performance with 20-25% on x86.
    36303df0
crc32.c 15.9 KB