Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] implementing bit vectors in OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Fabrice Le Fessant <lefessan@t...>
Subject: Re: [Caml-list] implementing bit vectors in OCaml

>  We have a program that is spending a lot of time in set operations,
>  and we're thinking of trying an imperative implementation based on bit vectors.
>  I would hope that the basis of such an implementation would be an array
>  of native integers, but on scrutinizing the manual (espeically the chapter
>  on interfacing to C), I have concluded that such a thing is not possible.
>  Our choices appear to be
>    * An array of native integers, which will be implemented as an array
>      of pointers to native integers, because integers are boxed.
>    * An array of tagged integers, which will be less efficient as
>      dividing by 31 is more expensive than shifting.

You can also lose some space, and use only 16 bits by integer, and the division will be less expensive.

- Fabrice

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: