File: multibitnums.html

package info (click to toggle)
ruby-multibitnums 0.1.4-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, jessie-kfreebsd, sid, stretch
  • size: 92 kB
  • ctags: 26
  • sloc: ansic: 125; ruby: 122; makefile: 4
file content (68 lines) | stat: -rw-r--r-- 2,591 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?xml version="1.0" ?>
<!DOCTYPE html 
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>multibitnums.c</title>
</head>
<body>
<h1><a name="label:0" id="label:0">Class MultiBitNums</a></h1><!-- RDLabel: "Class MultiBitNums" -->
<p>Class of multiple multi-bit data packed in a C string.
The number of bits is fixed to an arbitrary value.
For example, it can accommodate 11-bit integers.</p>
<h3><a name="label:1" id="label:1">Function overview</a></h3><!-- RDLabel: "Function overview" -->
<p>Integer encoding/decoding (so far only decoding has been implemented):</p>
<ul>
<li>Each segment of data is assumed to be multi-bit (fixed-length)
    unsigned integer in network byte order (big endian).</li>
<li>Note: integers of the system does not have to be big-endian (Only 
    the binary data is interpreted as unsigned big-endian).</li>
</ul>
<h3><a name="label:2" id="label:2">Class Methods</a></h3><!-- RDLabel: "Class Methods" -->
<dl>
<dt><a name="label:3" id="label:3"><code>MultiBitNums.new( <var>str</var>, <var>nbit</var>  [, <var>nint</var>] )</code></a></dt><!-- RDLabel: "MultiBitNums.new" -->
<dd>
<p>Creates a new object from a binary data (string) containing multi-bit 
segments.</p>
<p>ARGUMENTS</p>
<ul>
<li>str (String): binary data containing multi-bit data</li>
<li>nbit (Integer): length in bits of each segments contained in str</li>
<li>nint (Integer, can be omitted): number of nbit-bit data in str. If
       omitted, derived automatically from the length of str.</li>
</ul>
<p>RETURN VALUE</p>
<ul>
<li>a MultiBitNums object</li>
</ul>
<p>ERRORS</p>
<ul>
<li>exception is raised if nint is too large for the length of str.</li>
</ul></dd>
</dl>
<h3><a name="label:4" id="label:4">Instance Methods</a></h3><!-- RDLabel: "Instance Methods" -->
<dl>
<dt><a name="label:5" id="label:5"><code>to_int32str</code></a></dt><!-- RDLabel: "to_int32str" -->
<dd>
<p>Converts into a string containing binary data of 32-bit integers
of the system. Useful with NArray.</p>
<p>ARGUMENTS</p>
<pre>(none)</pre>
<p>RETURN VALUE</p>
<ul>
<li>a String (Its binary expression depends on the integer
       expression of the system). </li>
</ul>
<p>ERRORS</p>
<ul>
<li>exception is raised if nbit (see <a href="#label:3">MultiBitNums.new</a>) is greater than 32.</li>
</ul>
<p>EXAMPLE</p>
<pre>mb = MultiBitNums.new(str, nbits)
require "narray"           # download it from RAA at www.ruby-lang.org
ary = NArray.to_na( mb, "int" )  # the data is read into a NArray ary</pre></dd>
</dl>

</body>
</html>