CRC16 in erlang
Thomas Lindgren
thomasl_erlang@REDACTED
Tue Jan 31 14:58:24 CET 2006
--- Rudolph van Graan <rvg@REDACTED> wrote:
> Hi Joe,
>
> Here is one which I wrote some time ago. It does
> work, but there
> might be some issues. (No guarantees on speed!)
Here is an easy speedup:
-define(CRC16Def, {...}).
crc_index(N) -> element(N+1, ?CRC16Def).
This is O(1) time rather than O(N) and 1/2 the space
of the original definition. Pretty good, but there's
more.
Even better: pass around CRC_tab as a parameter and
you save allocating 256 words (+ up to 256 bignums; I
can't find the size of a bignum at the moment, but
perhaps a further 2 words/bignum?) per indexing
operation :-)
Best,
Thomas
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the erlang-questions
mailing list