lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


matthias wrote:
I wrote my own Lua-crc function and got some weired results. For
proofing correctness I also implemented a c-program.
But when the c-program returned a negative value (with %d) I got a
different value from the Lua-library.

There is no such thing as a negative number in a CRC calculation. If you got a negative number displayed, it's in the wrong representation.

If you have got sample code and test cases to show us, perhaps someone on the list can point out the specifics.

My algorithm is quite similar to the one from lash-lua:
http://code.google.com/p/lash-lua/source/browse/trunk/crc32.c?spec=svn5&r=5#112
[snip snip]

--
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia