Traversing a binary

Javier París Fernández paris@REDACTED
Tue Sep 21 19:19:17 CEST 2004


On Tue, Sep 21, 2004 at 09:45:05AM -0700, Thomas Lindgren wrote:
> The C code will be difficult to beat in this sort of
> program. I can't see any obvious way to improve on the
> program above either. (Though I wonder if you really
> want '+' or 'bxor' in the above?)

It's the Tcp checksum, and it is defined that way in the 
rfc. I agree that it is a bit strange.

> There is also another possibility. A few weeks ago, in
> the context of binary comprehensions, I floated the
> concept of fold operations over binaries. If one would
> restrict the operations suitably, a fast checksum
> might look like
> 
>    binary:foldl('16-bit +', 0, Bin)

I was thinking in something like that too. Any chance it
will be added sometime? :) 

> But that is in the future, if at all. At this point in
> time, I would tentatively recommend using your C
> driver.

It seems the best for now. Thanks!




More information about the erlang-questions mailing list