Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 37 additions & 23 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,59 @@ on: [push, pull_request]

jobs:
build:
name: build (${{ matrix.os }}, ${{ matrix.ocaml.version || matrix.ocaml }})
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
ocaml-version:
- 4.02.3
- 4.03.0
- 4.04.2
- 4.05.0
- 4.06.1
- 4.07.1
- 4.08.1
- 4.09.1
- 4.10.2
- 4.11.2
- 4.12.0
os: ['ubuntu-latest']
ocaml: [{version: '4.02',
repo: 'archive: git+https://github.com/ocaml/opam-repository-archive.git'},
'4.03',
'4.04',
'4.05',
'4.06',
'4.07',
'4.08',
'4.09',
'4.10',
'4.11',
'4.12',
'4.13',
'4.14',
'5.0',
'5.1',
'5.2',
'5.3']
include:
- os: windows-latest
ocaml-version: 4.02.3
ocaml: '4.13'
- os: windows-latest
ocaml-version: 4.12.0
ocaml: '5.3'
- os: macos-13
ocaml: {version: '4.02',
pin: 'camlp-streams git+https://github.com/dra27/camlp-streams.git#old',
repo: 'archive: git+https://github.com/ocaml/opam-repository-archive.git'}
- os: macos-latest
ocaml-version: 4.02.3
- os: macos-latest
ocaml-version: 4.12.0
ocaml: '5.3'

runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set-up OCaml ${{ matrix.ocaml-version }}
uses: avsm/setup-ocaml@v1
- name: Set-up OCaml ${{ matrix.build.ocaml }}
uses: ocaml/setup-ocaml@v3
with:
ocaml-version: ${{ matrix.ocaml-version }}
ocaml-compiler: ${{ matrix.ocaml.version || matrix.ocaml }}
opam-repositories: |-
default: git+https://github.com/ocaml/opam-repository.git
${{ matrix.ocaml.repo }}

- run: opam pin add bitmasks.dev . --no-action
- name: ${{ matrix.ocaml.pin && format('opam pin add {0}', matrix.ocaml.pin) || 'opam pin hhotfixes' }}
if: matrix.ocaml.pin
run: opam pin add --no-action ${{ matrix.ocaml.pin }}
- run: opam install . --deps-only --with-doc --with-test
- run: opam exec -- dune build @install @runtest
- run: opam exec -- make doc
3 changes: 3 additions & 0 deletions BitMaskSet.ml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ module type S =
val find_first_opt : (elt -> bool) -> t -> elt option
val find_last : (elt -> bool) -> t -> elt
val find_last_opt : (elt -> bool) -> t -> elt option
val to_list : t -> elt list
val of_list : elt list -> t
val to_seq_from : elt -> t -> elt Seq.t
val to_seq : t -> elt Seq.t
Expand Down Expand Up @@ -518,6 +519,8 @@ module Make(Mask : BitMask) : sig
in
f [] topbit highest shiftsInv

let to_list = elements

let min_elt set =
let set = Mask.logand set Mask.mask
in
Expand Down
12 changes: 12 additions & 0 deletions BitMaskSet.mli
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ module type S =
val find_last : (elt -> bool) -> t -> elt
val find_last_opt : (elt -> bool) -> t -> elt option

(* ****************************************************************************************** *
* Added in 5.1.0. *
* ****************************************************************************************** *)
val to_list : t -> elt list

(* ****************************************************************************************** *
* Added in 4.02.0. *
* ****************************************************************************************** *)
Expand Down Expand Up @@ -422,6 +427,13 @@ module Make (Mask : BitMask) :
@since 1.1.0
*)

val to_list : t -> Mask.t list
(**
[to_list s] is {!elements}[ s].

@since 1.5.0
*)

val of_list : Mask.t list -> t
(**
[of_list l] creates a bitmask from a list of elements. For bitmasks, this is just a
Expand Down
4 changes: 4 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
????-??-?? David Allsopp <david.allsopp -at- metastack.dot.com>
Version 1.5.1
* Add new to_list function introduced in OCaml 5.1.0

2021-08-03 David Allsopp <david.allsopp -at- metastack.dot.com>
Version 1.4.0
* Add new to_rev_seq function introduced in OCaml 4.12.0
Expand Down
4 changes: 2 additions & 2 deletions bitmasks.opam
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
opam-version: "2.0"
version: "1.4.1"
version: "1.5.0"
maintainer: "david.allsopp@metastack.com"
authors: [ "David Allsopp" ]
license: "BSD-3-clause with OCaml linking exception"
license: "BSD-3-clause"
homepage: "https://metastack.github.io/bitmasks"
dev-repo: "git+https://github.com/metastack/bitmasks.git"
bug-reports: "https://github.com/metastack/bitmasks/issues"
Expand Down