[Please keep the mailing list in CC.] Sam Russell wrote: > > 1) Add into comments references to the research papers that are used in > > or are useful to understand the code. Like the "Intel paper" that you > > showed us in the beginning. > > done > > > 2) Generate the tables at build time. > > Step 1: Move the tables into a file lib/crc-sliceby8.h > > done > > > Step 2: Extend your program lib/crc-generate-table.c > > done > > > Step 3: Write a Makefile.am rule, in modules/crc, that runs the > generator. > > I'm not super good at automake, I would appreciate some tips here. I > couldn't see where lib/gen-uni-tables.c gets invoked, is it possible that > we could just ship the generator as-is given this is done elsewhere?> > > > 3) Use GNU coding style: > > done > > Let me know if I've missed anything. Happy for the table generation to be > tied into automake, but I've not done this before so if this is super > important then I would really appreciate some help making this happen. > > Cheers > Sam
Regarding the Automake stuff, please try the attached patch, on top of your patch. Untested, but should be quite close to working. Regarding GNU coding style, there are still tweaks needed in crc-generate-table.c lines 54, 56, 83, 87, 100..114, 120..123, crc.c line 92. Other nitpicking: The generated file does not end in a newline. Could you add a newline at the end? Just because it's the common convention. In the 'main' function, please add a 'return 0;' statement at the end. It's needed for Oracle cc 12.6. The new code in crc.c makes use of uint64_t. Therefore, for my feeling, the '#include <stdint.h>', should go into crc.c. And then you don't need it in the generated file. The function crc32_update_no_xor_slice_by_8 is not an exported API. Therefore it should better be 'static'. Bruno
diff --git a/modules/crc b/modules/crc index bd7fe29dba..0c9a475e96 100644 --- a/modules/crc +++ b/modules/crc @@ -13,6 +13,18 @@ configure.ac: Makefile.am: lib_SOURCES += crc.c +$(srcdir)/crc-sliceby8.h: $(srcdir)/crc-generate-table.c + if test @CROSS_COMPILING@ = no; then \ + $(COMPILE) $(AM_LDFLAGS) $(LDFLAGS) -o crc-generate-table $(srcdir)/crc-generate-table.c \ + && ./crc-generate-table > $(srcdir)/crc-sliceby8.h-t \ + && rm -f crc-generate-table \ + && mv $(srcdir)/crc-sliceby8.h-t $(srcdir)/crc-sliceby8.h; \ + fi +BUILT_SOURCES += crc-sliceby8.h +MOSTLYCLEANFILES += crc-sliceby8.h-t crc-generate-table +MAINTAINERCLEANFILES += crc-sliceby8.h +EXTRA_DIST += crc-sliceby8.h + Include: "crc.h"