Jessica Hamilton
unread,May 14, 2009, 1:28:00 AM5/14/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to bitstring
I have a little query :)
For the network stack I'm implementing for snowflake[1], I'm using
bitstring quite extensively.
However, I wonder if there's a better approach to chaining the parsing
of bitstrings.
Currently, I do something like:
let parse_eth bits = bitmatch bits with { .....; content : -1 :
bitstring } -> (* return a type encapsulating content *)
let parse_ip bits = bitmatch bits with { .....; content : -1 :
bitstring } -> (* return a type encapsulating content *)
etc.
Is there much/any overhead in doing:
let eth = parse_eth data in
if eth encapsulate an IP packet then
let ip = parse_ip eth.content in
do something with ip
I'm pretty sure it doesn't use String.sub in this case, avoiding any
copying.
Jessica