ocaml-containers/2.7/containers/CCBitField/index.html
2019-11-11 22:39:35 -06:00

12 lines
No EOL
2.6 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>CCBitField (containers.CCBitField)</title><link rel="stylesheet" href="../../odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc %%VERSION%%"/><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</a> &#x00BB; 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 |&gt; B.set x true |&gt; B.set y true;;
assert (not (B.get z f)) ;;
assert (f |&gt; B.set z true |&gt; 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-X/index.html">X</a> : <span class="keyword">sig</span> ... <span class="keyword">end</span>) <span>&#45;&gt;</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>