From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 3941B7EE51 for ; Fri, 17 May 2013 18:21:50 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of rich@annexia.org) identity=pra; client-ip=80.68.91.176; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="rich@annexia.org"; x-sender="rich@annexia.org"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of rich@annexia.org designates 80.68.91.176 as permitted sender) identity=mailfrom; client-ip=80.68.91.176; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="rich@annexia.org"; x-sender="rich@annexia.org"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@furbychan.cocan.org) identity=helo; client-ip=80.68.91.176; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="rich@annexia.org"; x-sender="postmaster@furbychan.cocan.org"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgkFAM5XllFQRFuw/2dsb2JhbABbgwjCAH4WdIIfAQEFOk8LGAkTEg8FKIhEvUqGHYdNgT4Wgl1hA5c3kUGDEDuBLQ X-IPAS-Result: AgkFAM5XllFQRFuw/2dsb2JhbABbgwjCAH4WdIIfAQEFOk8LGAkTEg8FKIhEvUqGHYdNgT4Wgl1hA5c3kUGDEDuBLQ X-IronPort-AV: E=Sophos;i="4.87,693,1363129200"; d="scan'208";a="17961578" Received: from furbychan.cocan.org ([80.68.91.176]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES256-SHA; 17 May 2013 18:21:49 +0200 Received: from rich by furbychan.cocan.org with local (Exim 4.72) (envelope-from ) id 1UdNPh-0006JG-KX for caml-list@inria.fr; Fri, 17 May 2013 17:21:49 +0100 Date: Fri, 17 May 2013 17:21:49 +0100 From: "Richard W.M. Jones" To: caml-list@inria.fr Message-ID: <20130517162149.GB9228@annexia.org> References: <20130514164504.GA9228@annexia.org> <5192DFA0.2080706@riken.jp> <20130517161559.GE32353@annexia.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130517161559.GE32353@annexia.org> User-Agent: Mutt/1.5.20 (2009-06-14) Subject: Re: [Caml-list] ANNOUNCE: ocaml-bitstring 2.0.4 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