From: Nicolas C. <war...@fr...> - 2004-03-19 12:28:21
|
> Hello ! > > I made a few changes on the files bitSet.ml and bitSet.mli (see > attachements). I : > > 1 - corrected a few orthograph mistakes (I hope I didn't added new ones) > 2 - corrected an "lsl" -> "lsr" (the size of a BitSet was 8 times bigger > instead of 8 times smaller) > 3 - suggested the name "copy" which is more usual than "clone" > 4 - used "blit_string" and "fill_string" for more efficiency > 5 - added some functions on sets > > I hope there are no more mistakes. I have got a question : isn't it > possible to use the 32 bits of an int (or 64 bits, depending on the > architecture) for efficients BitSets ? The String functions seem to work > on 8 bits only. > > TIA for your answers, Thanks, I'll review theses changes. Concerning the usage of int, OCaml runtime representation is 31 bits. They are unboxed and shifted by 1 and the lowest bit is set to 1 so it can't be mistaken with an address since all addresses are always aligned on 2 bytes (even 4 on most of 32-bits architectures) . So we could use ints as 31 bits but we would then need to div/mod to get the correct integer. Another nice thing about strings is that their contents are not scanned by the GC while Array of ints are. Regards, Nicolas Cannasse |