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 E0CF17F891 for ; Tue, 18 Mar 2014 21:59:56 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of dra-news@metastack.com) identity=pra; client-ip=62.13.149.77; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="dra-news@metastack.com"; x-sender="dra-news@metastack.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of dra-news@metastack.com designates 62.13.149.77 as permitted sender) identity=mailfrom; client-ip=62.13.149.77; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="dra-news@metastack.com"; x-sender="dra-news@metastack.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@outmail149077.authsmtp.com) identity=helo; client-ip=62.13.149.77; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="dra-news@metastack.com"; x-sender="postmaster@outmail149077.authsmtp.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Aq8BAO6yKFM+DZVNnGdsb2JhbABag0HEKBYOAQEBAQEIFAk8giwIAh4STAUWUiMcAQQeBQuHYgmeYLFmkyEEjzqKPpQr X-IPAS-Result: Aq8BAO6yKFM+DZVNnGdsb2JhbABag0HEKBYOAQEBAQEIFAk8giwIAh4STAUWUiMcAQQeBQuHYgmeYLFmkyEEjzqKPpQr X-IronPort-AV: E=Sophos;i="4.97,680,1389740400"; d="scan'208";a="63522268" Received: from outmail149077.authsmtp.com ([62.13.149.77]) by mail2-smtp-roc.national.inria.fr with ESMTP; 18 Mar 2014 21:59:56 +0100 Received: from mail-c237.authsmtp.com (mail-c237.authsmtp.com [62.13.128.237]) by punt15.authsmtp.com (8.14.2/8.14.2/) with ESMTP id s2IKxteP058868 for ; Tue, 18 Mar 2014 20:59:55 GMT Received: from romulus.metastack.com (cpc1-cmbg5-0-0-cust241.5-4.cable.virginm.net [81.98.252.242]) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2/) with ESMTP id s2IKxpMv010948 for ; Tue, 18 Mar 2014 20:59:51 GMT Received: from Altus ([172.16.0.18]) (authenticated bits=0) by romulus.metastack.com (8.14.2/8.14.2) with ESMTP id s2IKxoRe003624 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Tue, 18 Mar 2014 20:59:51 GMT From: "David Allsopp" To: "OCaml List" Date: Tue, 18 Mar 2014 21:01:35 -0000 Organization: MetaStack Solutions Ltd. Message-ID: <000001cf42ed$400203f0$c0060bd0$@metastack.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-Index: Ac9C61gX1XYhAPV2SXebi/BPqK2LZw== Content-Language: en-gb X-Scanned-By: MIMEDefang 2.65 on 172.16.0.20 X-Server-Quench: 3fd9502e-aee0-11e3-94fa-002590a135d3 X-AuthReport-Spam: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-AuthRoute: OCd1ZAARAlZZVg1f DC4bFwdFRBksPQFF ChxFJgxfNlEAUAAU NkdBMnJSNkcdTBdX QSgKU0spAR9uW2N0 bxpTbQ9Ya0BLXkti UVZASkxQEQd2AxgD GRwbTRk8NAc/AzYw GABiX3BSWEw0d0J5 QQBXQzkPYGdiPX1O BRVYagJVJQBXdxsT O01/VHEIaGVWZ3ll E1QlDBkXGwAXAiVJ ZwgWLklaGABTWGZU X-Authentic-SMTP: 61633634383431.1024:706 X-AuthFastPath: 0 (Was 255) X-AuthSMTP-Origin: 81.98.252.242/25 X-AuthVirus-Status: No virus detected - but ensure you scan with your own anti-virus system. Subject: [Caml-list] [ANN] BitMasks 1.0.0 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