mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
12 lines
No EOL
2.6 KiB
HTML
12 lines
No EOL
2.6 KiB
HTML
<!DOCTYPE html>
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>CCBitField (containers-data.CCBitField)</title><link rel="stylesheet" href="../../odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 1.5.1"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="content"><header><nav><a href="../index.html">Up</a> – <a href="../index.html">containers-data</a> » CCBitField</nav><h1>Module <code>CCBitField</code></h1><h2 id="bit-field"><a href="#bit-field" class="anchor"></a>Bit Field</h2><p>This module defines efficient bitfields up to 30 or 62 bits (depending on the architecture) in a relatively type-safe way.</p><pre><code class="ml">module B = CCBitField.Make(struct end);;
|
||
|
||
let x = B.mk_field ()
|
||
let y = B.mk_field ()
|
||
let z = B.mk_field ()
|
||
|
||
let f = B.empty |> B.set x true |> B.set y true;;
|
||
|
||
assert (not (B.get z f)) ;;
|
||
|
||
assert (f |> B.set z true |> B.get z);;</code></pre></header><dl><dt class="spec exception" id="exception-TooManyFields"><a href="#exception-TooManyFields" class="anchor"></a><code><span class="keyword">exception</span> </code><code><span class="exception">TooManyFields</span></code></dt><dd><p>Raised when too many fields are packed into one bitfield.</p></dd></dl><dl><dt class="spec exception" id="exception-Frozen"><a href="#exception-Frozen" class="anchor"></a><code><span class="keyword">exception</span> </code><code><span class="exception">Frozen</span></code></dt><dd><p>Raised when a frozen bitfield is modified.</p></dd></dl><dl><dt class="spec value" id="val-max_width"><a href="#val-max_width" class="anchor"></a><code><span class="keyword">val</span> max_width : int</code></dt><dd><p>System-dependent maximum width for a bitfield, typically 30 or 62.</p></dd></dl><dl><dt class="spec module-type" id="module-type-S"><a href="#module-type-S" class="anchor"></a><code><span class="keyword">module</span> <span class="keyword">type</span> <a href="module-type-S/index.html">S</a> = <span class="keyword">sig</span> ... <span class="keyword">end</span></code></dt><dd></dd></dl><dl><dt class="spec module" id="module-Make"><a href="#module-Make" class="anchor"></a><code><span class="keyword">module</span> <a href="Make/index.html">Make</a> : <span class="keyword">functor</span> (<a href="Make/argument-1-_/index.html">_</a> : <span class="keyword">sig</span> ... <span class="keyword">end</span>) <span>-></span> <a href="index.html#module-type-S">S</a></code></dt><dd><p>Create a new bitfield type</p></dd></dl></div></body></html> |