Sam Russell <sam.h.russ...@gmail.com> writes: > One issue I've noticed is that the crc functions take a char* and while > this is ok in other implementations, gnulib appears to enforce strict > alignment (presumably for portability purposes). > > Because of this, we might need to introduce a new function that takes an > unsigned long long* (and then _m128* when we do the SSE4.1 option) because > casting a char* doesn't work. > > Do you know of any workarounds here? memcpy() to an unsigned long long* > solves the alignment problem but adds a performance overhead. If the worst > case is better than the existing algorithm then it might be worth it > though... It would make sense to also offer a second function to allow > callers to dump in a block of guaranteed-aligned memory.
Can't you do the CRC byte-by-byte until you reach an address that is properly aligned? See lib/memchr.c for an example. Thanks for working on this, by the way. Collin