caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] ANNOUNCE: ocaml-bitstring 2.0.4
@ 2013-05-14 16:45 Richard W.M. Jones
  2013-05-15 17:38 ` Florent Monnier
       [not found] ` <5192DFA0.2080706@riken.jp>
  0 siblings, 2 replies; 4+ messages in thread
From: Richard W.M. Jones @ 2013-05-14 16:45 UTC (permalink / raw)
  To: caml-list


bitstring is a library for manipulating bitstrings, binary file
formats, protocols, etc from OCaml.

http://code.google.com/p/bitstring/

The list of changes is here:

http://code.google.com/p/bitstring/source/list

Rich.

-- 
Richard Jones
Red Hat

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] ANNOUNCE: ocaml-bitstring 2.0.4
  2013-05-14 16:45 [Caml-list] ANNOUNCE: ocaml-bitstring 2.0.4 Richard W.M. Jones
@ 2013-05-15 17:38 ` Florent Monnier
       [not found] ` <5192DFA0.2080706@riken.jp>
  1 sibling, 0 replies; 4+ messages in thread
From: Florent Monnier @ 2013-05-15 17:38 UTC (permalink / raw)
  To: Richard W.M. Jones; +Cc: caml-list

2013/5/14, Richard W.M. Jones:
>
> bitstring is a library for manipulating bitstrings, binary file
> formats, protocols, etc from OCaml.
>
> http://code.google.com/p/bitstring/
>
> The list of changes is here:
>
> http://code.google.com/p/bitstring/source/list

In Mageia community it's asked to us that when a project lists the
distros where it's available and when Mageia is missing to ask that it
is added.
So this is what I do:

On your webpage it is written :
"""Bitstring is available in newer releases of Fedora and Debian."""

Could you please add that it's available in Mageia too ?
"""Bitstring is available in newer releases of Fedora, Mageia and Debian."""

Thanks!
--

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] ANNOUNCE: ocaml-bitstring 2.0.4
       [not found] ` <5192DFA0.2080706@riken.jp>
@ 2013-05-17 16:15   ` Richard W.M. Jones
  2013-05-17 16:21     ` Richard W.M. Jones
  0 siblings, 1 reply; 4+ messages in thread
From: Richard W.M. Jones @ 2013-05-17 16:15 UTC (permalink / raw)
  To: Francois Berenger, caml-list

On Wed, May 15, 2013 at 10:06:40AM +0900, Francois Berenger wrote:
[...]

I'm not familiar with the problem domain you mention, however:

> I mean, the bitstring can be huge, like millions of bits?

They can be as long as strings in OCaml.  Hence there's a limit of 16
MBytes on 32 bit architectures.  It's (generally) advisable to use a
64 bit machine, and bitstrings are effectively unlimited on 64 bit.

Sub-bitstrings are implemented efficiently, without copying.

Bitstring matching complexity depends on the number of fields you want
to match, not (at least, not obviously that I can see) on the size of
fields or the size of the bitstring.  If you write a bitmatch that
matches a really massive number of fields [thousands?], then you'll
probably run into problems with the OCaml compiler, since the
bitstring macros can generate a great deal of code behind the scenes.

It is a lot more efficient if the fields are aligned and the offset of
each field is known at compile time.  However it still works,
inefficiently, even if they are not.

I use bitstring a lot to parse files.  However I don't usually load up
the whole file into a single bitstring, but instead seek + read parts
of the file.  But that's just for programming convenience; it should
be possible to bitmatch over subbitstrings of a whole file if you find
that easier.

Rich.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] ANNOUNCE: ocaml-bitstring 2.0.4
  2013-05-17 16:15   ` Richard W.M. Jones
@ 2013-05-17 16:21     ` Richard W.M. Jones
  0 siblings, 0 replies; 4+ messages in thread
From: Richard W.M. Jones @ 2013-05-17 16:21 UTC (permalink / raw)
  To: caml-list

On Fri, May 17, 2013 at 05:15:59PM +0100, Richard W.M. Jones wrote:
> On Wed, May 15, 2013 at 10:06:40AM +0900, Francois Berenger wrote:
> > I mean, the bitstring can be huge, like millions of bits?
> 
> They can be as long as strings in OCaml.  Hence there's a limit of 16
> MBytes on 32 bit architectures.  It's (generally) advisable to use a
> 64 bit machine, and bitstrings are effectively unlimited on 64 bit.
> 
> Sub-bitstrings are implemented efficiently, without copying.

To be plainer, this is the definition of a bitstring:

  (* A bitstring is simply the data itself (as a string), and the
   * bitoffset and the bitlength within the string.  Note offset/length
   * are counted in bits, not bytes.
   *)
  type bitstring = string * int * int

and this is how a subbitstring is made:

  let subbitstring (data, off, len) off' len' =
    let off = off + off' in
    if off' < 0 || len' < 0 || off' > len - len' then
      invalid_arg "subbitstring";
    (data, off, len')

Rich.

-- 
Richard Jones
Red Hat

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-05-17 16:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-14 16:45 [Caml-list] ANNOUNCE: ocaml-bitstring 2.0.4 Richard W.M. Jones
2013-05-15 17:38 ` Florent Monnier
     [not found] ` <5192DFA0.2080706@riken.jp>
2013-05-17 16:15   ` Richard W.M. Jones
2013-05-17 16:21     ` Richard W.M. Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).