From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr 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 DD2A37F891 for ; Tue, 18 Mar 2014 22:31:02 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of yminsky@janestreet.com) identity=pra; client-ip=38.105.200.229; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="yminsky@janestreet.com"; x-sender="yminsky@janestreet.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of yminsky@janestreet.com designates 38.105.200.229 as permitted sender) identity=mailfrom; client-ip=38.105.200.229; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="yminsky@janestreet.com"; x-sender="yminsky@janestreet.com"; 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@mx5.mail.janestreet.com) identity=helo; client-ip=38.105.200.229; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="yminsky@janestreet.com"; x-sender="postmaster@mx5.mail.janestreet.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: As0BAPW5KFMmacjlnGdsb2JhbABag0FXqzqNcIh6gSceDgEBAQEBBhYJPIIlAQEBAwFAAQEsCwEECwsLAxchIhIBBQEKEgYTEggBh0oDCQgDAgihcYsYhFUBBZc0A4ccEQaOXgQHhDiYSoEyjxAYKYRu X-IPAS-Result: As0BAPW5KFMmacjlnGdsb2JhbABag0FXqzqNcIh6gSceDgEBAQEBBhYJPIIlAQEBAwFAAQEsCwEECwsLAxchIhIBBQEKEgYTEggBh0oDCQgDAgihcYsYhFUBBZc0A4ccEQaOXgQHhDiYSoEyjxAYKYRu X-IronPort-AV: E=Sophos;i="4.97,680,1389740400"; d="scan'208";a="63524731" Received: from mx5.janestreet.com (HELO mx5.mail.janestreet.com) ([38.105.200.229]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 18 Mar 2014 22:31:01 +0100 Received: from tot-oib-smtp1.delacy.com ([172.27.22.15] helo=tot-smtp) by mx5.mail.janestreet.com with esmtp (Exim 4.76) (envelope-from ) id 1WQ1b9-0006tf-GN for caml-list@inria.fr; Tue, 18 Mar 2014 17:30:59 -0400 Received: from tot-dmz-mxgoog1.delacy.com ([172.27.224.14] helo=mxgoog2.janestreet.com) by tot-smtp with esmtps (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1WQ1b9-0002r6-Ev for caml-list@inria.fr; Tue, 18 Mar 2014 17:30:59 -0400 Received: from mail-la0-f44.google.com ([209.85.215.44]) by mxgoog2.janestreet.com with esmtp (Exim 4.76) (envelope-from ) id 1WQ1b9-0001Nh-7r for caml-list@inria.fr; Tue, 18 Mar 2014 17:30:59 -0400 Received: by mail-la0-f44.google.com with SMTP id hr13so5315241lab.31 for ; Tue, 18 Mar 2014 14:30:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=HZvjGncz1UzYpI6R+gd1e962v5jKdWGcJfxKBtIp2Ts=; b=m7UU+HK2GWpvOYfeqjWHhcQSLiBkvdHcFC3PXF1/l7ohd2UGnhjajqfOLZ2TzAG4CQ QRGrPowpKGt9B4QIicPfkRDt5TGc5SAx7bxZOclYEiurjv5gMCwS9hzekrC/J0I0pdaG zpqP7bA4dOCj0pIfBqEB+KrWYGKUsHv2j4GYg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=HZvjGncz1UzYpI6R+gd1e962v5jKdWGcJfxKBtIp2Ts=; b=eVGbiFYVzF85S+k0r+Qg/TeRlLmydu5gpBALfVBWhHAedBf9REsTUxX8tZdvo6ghiG s+Vyv139/SbiLOEz3ofZfXalwZnRBbEwud19LycuwayEP8g6OVKjLgynQfwrrYuCJ8m6 ZpXNSEqEGdh+VhDm1Alw6AuofXL13hA/9iLS1KD2pR7SreF1idpqSll7nAVRAxmyUvnr bk+0H18A4eAJslp+yBo6Uzs7EJiq7ltKhN1sSVUwMCwFPGEiGuMXJfOnnXlcVFTD5Gl0 Mg0mIcp9a5k3j3sdkvbbi0LVdTKsrym1f0rcFH6jVEhUAdyZ370UL1PkT8EsfDx5pI6M y5xw== X-Gm-Message-State: ALoCoQkgME7w8i1HlI8yjCUbzGkl1zA9mXFFMUFVzd1ZVT3CYAw1JfYO15TAGgWrtXhIdapO/ZnZH4yKe20x97njuP1Y0O86/7NWOw5YO9t4xiqboFX3bdXfOlrJFpZydZgfrl1ffBdepohUl1bZmrYe+rOg7PZ1XQ== X-Received: by 10.112.52.225 with SMTP id w1mr17592222lbo.22.1395178258565; Tue, 18 Mar 2014 14:30:58 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.112.52.225 with SMTP id w1mr17592214lbo.22.1395178258462; Tue, 18 Mar 2014 14:30:58 -0700 (PDT) Received: by 10.112.170.40 with HTTP; Tue, 18 Mar 2014 14:30:58 -0700 (PDT) In-Reply-To: <000001cf42ed$400203f0$c0060bd0$@metastack.com> References: <000001cf42ed$400203f0$c0060bd0$@metastack.com> Date: Wed, 19 Mar 2014 08:30:58 +1100 Message-ID: From: Yaron Minsky To: David Allsopp Cc: OCaml List Content-Type: multipart/alternative; boundary=001a11c3fe907e858c04f4e84055 Subject: Re: [Caml-list] [ANN] BitMasks 1.0.0 --001a11c3fe907e858c04f4e84055 Content-Type: text/plain; charset=ISO-8859-1 You might be interested also in the Flags module in Core_kernel, which aims to serve a similar purpose. https://ocaml.janestreet.com/ocaml-core/111.03.00/doc/core_kernel/#Flags https://github.com/janestreet/core_kernel/blob/master/lib/flags.ml https://github.com/janestreet/core_kernel/blob/master/lib/flags.mli https://github.com/janestreet/core_kernel/blob/master/lib/flags_intf.ml y On Wed, Mar 19, 2014 at 8:01 AM, David Allsopp wrote: > Firstly, many thanks for the various replies to my earlier request for > pointers and guidance on packaging earlier this month. > > I'm pleased to announce the release of BitMasks 1.0.0. This library is > designed primarily with C bindings in mind and is yet another solution to > the "how do we manipulate integer bitmask flags functionally" problem. So, > given an integer where bit 0 means something, bit 1 means something else > and > bit 2 yet something further, this library allows that to be exposed as type > t = Foo | Bar | Baz and have the integer be constructed as though it were a > set. > > This implementation has three key features: > * Underlying type is provided through a functor (so int or int64 or indeed > an arbitrary precision integer can be used) > * There's no copying, so the original integer can still be used (either > internally or, at the whim of the programmer, the integer can be exposed). > This has significant advantages over, for example, returning the a list of > the bits which are set. > * The resulting signature is compatible with Set.S in the standard library > > Project home: http://forge.ocamlcore.org/projects/bitmasks/ > Repository: https://github.com/meta-stack/bitmasks > OPAM package: bitmasks > > The source includes a full example. I believe having looked at other code > out there that Core follows a similar philosophy. > > The original motivation for this library was to provide a sane handling for > the myriad masks of information returned by ODBC's SQLGetInfo function, but > I've found it be useful in other bindings as well (particularly for > bindings > for some Raspberry Pi components which I hope to release soon) and hope > others may do too. > > Happy functional bit set manipulating! > > > David > > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > --001a11c3fe907e858c04f4e84055 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable


On Wed, Mar 19, 2014 at 8:01 AM, David A= llsopp <dra-news@metastack.com> wrote:
Firstly, many thanks for the various replies to my earlier request for
pointers and guidance on packaging earlier this month.

I'm pleased to announce the release of BitMasks 1.0.0. This library is<= br> designed primarily with C bindings in mind and is yet another solution to the "how do we manipulate integer bitmask flags functionally" pro= blem. So,
given an integer where bit 0 means something, bit 1 means something else an= d
bit 2 yet something further, this library allows that to be exposed as type=
t =3D Foo | Bar | Baz and have the integer be constructed as though it were= a
set.

This implementation has three key features:
* Underlying type is provided through a functor (so int or int64 or indeed<= br> an arbitrary precision integer can be used)
* There's no copying, so the original integer can still be used (either=
internally or, at the whim of the programmer, the integer can be exposed).<= br> This has significant advantages over, for example, returning the a list of<= br> the bits which are set.
* The resulting signature is compatible with Set.S in the standard library<= br>
Project home: http://forge.ocamlcore.org/projects/bitmasks/
Repository: https://github.com/meta-stack/bitmasks
OPAM package: bitmasks

The source includes a full example. I believe having looked at other code out there that Core follows a similar philosophy.

The original motivation for this library was to provide a sane handling for=
the myriad masks of information returned by ODBC's SQLGetInfo function,= but
I've found it be useful in other bindings as well (particularly for bin= dings
for some Raspberry Pi components which I hope to release soon) and hope
others may do too.

Happy functional bit set manipulating!


David


--
Caml-list mailing list. =A0Subscription management and archives:
ht= tps://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

--001a11c3fe907e858c04f4e84055--