• Radu Berinde's avatar
    hash/crc32: cleanup code and improve tests · bdde1013
    Radu Berinde authored
    Major reorganization of the crc32 code:
    
     - The arch-specific files now implement a well-defined interface
       (documented in crc32.go). They no longer have the responsibility of
       initializing and falling back to a non-accelerated implementation;
       instead, that happens in the higher level code.
    
     - The non-accelerated algorithms are moved to a separate file with no
       dependencies on other code.
    
     - The "cutoff" optimization for slicing-by-8 is moved inside the
       algorithm itself (as opposed to every callsite).
    
    Tests are significantly improved:
     - direct tests for the non-accelerated algorithms.
     - "cross-check" tests for arch-specific implementations (all archs).
     - tests for misaligned buffers for both IEEE and Castagnoli.
    
    Fixes #16909.
    
    Change-Id: I9b6dd83b7a57cd615eae901c0a6d61c6b8091c74
    Reviewed-on: https://go-review.googlesource.com/27935Reviewed-by: 's avatarKeith Randall <khr@golang.org>
    bdde1013
crc32.go 6.2 KB