ocaml-containers/3.6/containers/Containers_codegen/Bitfield/index.html
2021-10-18 22:33:12 -04:00

2 lines
No EOL
4.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>Bitfield (containers.Containers_codegen.Bitfield)</title><link rel="stylesheet" href="../../../odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 2.0.0"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> <a href="../../index.html">containers</a> &#x00BB; <a href="../index.html">Containers_codegen</a> &#x00BB; Bitfield</nav><header class="odoc-preamble"><h1>Module <code><span>Containers_codegen.Bitfield</span></code></h1></header><nav class="odoc-toc"><ul><li><a href="#generate-efficient-bitfields-that-fit-in-an-integer">Generate efficient bitfields that fit in an integer</a></li></ul></nav><div class="odoc-content"><h3 id="generate-efficient-bitfields-that-fit-in-an-integer"><a href="#generate-efficient-bitfields-that-fit-in-an-integer" class="anchor"></a>Generate efficient bitfields that fit in an integer</h3><div class="odoc-spec"><div class="spec type" id="type-t" class="anchored"><a href="#type-t" class="anchor"></a><code><span><span class="keyword">type</span> t</span></code></div></div><div class="odoc-spec"><div class="spec value" id="val-make" class="anchored"><a href="#val-make" class="anchor"></a><code><span><span class="keyword">val</span> make : <span>?emit_failure_if_too_wide:bool <span class="arrow">&#45;&gt;</span></span> <span>name:string <span class="arrow">&#45;&gt;</span></span> <span>unit <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Make a new bitfield with the given name.</p><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">name</span> <p>the name of the generated type</p></li></ul><ul class="at-tags"><li class="parameter"><span class="at-tag">parameter</span> <span class="value">emit_failure_if_too_wide</span> <p>if true, generated code includes a runtime assertion that <code>Sys</code>.int_size is wide enough to support this type</p></li></ul></div></div><div class="odoc-spec"><div class="spec value" id="val-field_bit" class="anchored"><a href="#val-field_bit" class="anchor"></a><code><span><span class="keyword">val</span> field_bit : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span>string <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>field_bit ty name</code> adds a field of size <code>1</code> to the bitfield <code>ty</code>, with name <code>name</code>. The generate code will provide get/set for a boolean.</p></div></div><div class="odoc-spec"><div class="spec value" id="val-field_int" class="anchored"><a href="#val-field_int" class="anchor"></a><code><span><span class="keyword">val</span> field_int : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span>width:int <span class="arrow">&#45;&gt;</span></span> <span>string <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>field_int ty name ~width</code> adds a field of size <code>width</code> to the bitfield with name <code>name</code>. The accessors will be for integers of <code>width</code> bits, and the setter might assert that the provided integer fits.</p></div></div><div class="odoc-spec"><div class="spec value" id="val-total_width" class="anchored"><a href="#val-total_width" class="anchor"></a><code><span><span class="keyword">val</span> total_width : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p>Total width in bits of the given bitfield.</p></div></div><div class="odoc-spec"><div class="spec value" id="val-gen_mli" class="anchored"><a href="#val-gen_mli" class="anchor"></a><code><span><span class="keyword">val</span> gen_mli : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <a href="../index.html#type-code">code</a></span></code></div><div class="spec-doc"><p>Generate code for the type signature for the given bitfield</p></div></div><div class="odoc-spec"><div class="spec value" id="val-gen_ml" class="anchored"><a href="#val-gen_ml" class="anchor"></a><code><span><span class="keyword">val</span> gen_ml : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <a href="../index.html#type-code">code</a></span></code></div><div class="spec-doc"><p>Generate code for the implementation for the given bitfield</p></div></div></div></body></html>