1CTIO(3CTYPE)                                                      CTIO(3CTYPE)
2
3
4

NAME

6       ctio,  ruint8,  ruint16,  ruint32,  ruint64,  wuint8, wuint16, wuint32,
7       wuint64, rsint8, rsint16, rsint32, rsint64, wsint8,  wsint16,  wsint32,
8       wsint64,  rfloat,  rdouble,  wfloat, wdouble - integer and float opera‐
9       tions
10

SYNOPSIS

12       var mod_ctype = require('ctype');
13
14       Number mod_ctype.ruint8(Buffer buf, String endian, Number offset);
15
16
17       Number mod_ctype.ruint16(Buffer buf, String endian, Number offset);
18
19
20       Number mod_ctype.ruint32(Buffer buf, String endian, Number offset);
21
22
23       Number[2] mod_ctype.ruint64(Buffer buf, String endian, Number offset);
24
25
26       Number mod_ctype.rsint8(Buffer buf, String endian, Number offset);
27
28
29       Number mod_ctype.rsint16(Buffer buf, String endian, Number offset);
30
31
32       Number mod_ctype.rsint32(Buffer buf, String endian, Number offset);
33
34
35       Number[2] mod_ctype.rsint64(Buffer buf, String endian, Number offset);
36
37
38       Number mod_ctype.rfloat(Buffer buf, String endian, Number offset);
39
40
41       Number mod_ctype.rdouble(Buffer buf, String endian, Number offset);
42
43
44       void mod_ctype.wuint8(Number value, String endian, Buffer buf, Number offset);
45
46
47       void mod_ctype.wuint16(Number value, String endian, Buffer buf, Number offset);
48
49
50       void mod_ctype.wuint32(Number value, String endian, Buffer buf, Number offset);
51
52
53       void mod_ctype.wuint64(Number[2] value, String endian, Buffer buf, Number offset);
54
55
56       void mod_ctype.wsint8(Number value, String endian, Buffer buf, Number offset);
57
58
59       void mod_ctype.wsint16(Number value, String endian, Buffer buf, Number offset);
60
61
62       void mod_ctype.wsint32(Number value, String endian, Buffer buf, Number offset);
63
64
65       void mod_ctype.wsint64(Number[2] value, String endian, Buffer buf, Number offset);
66
67
68       void mod_ctype.wfloat(Number value, String endian, Buffer buf, Number offset);
69
70
71       void mod_ctype.wdouble(Number value, String endian, Buffer buf, Number offset);
72
73

DESCRIPTION

75       The argument buf refers to a valid buffer (from calling new  Buffer()).
76       The argument endian is either the string 'big' or 'little' and controls
77       whether the data in the buffer is interpreted as big or little  endian.
78       The  argument  offset  indicates  the starting index into the buffer to
79       read or write. All functions ensure that starting at  offset  does  not
80       overflow  the end of the buffer. The argument value is a Number that is
81       the valid type for the specific function. All functions that take value
82       as an argument, verify that the passed value is valid.
83
84
85   ruint8(), ruint16(), ruint32()
86       The  ruint8(),  ruint16(),  and  ruint32() functions read an 8, 16, and
87       32-bit unsigned value from buf and return it. The value read is  influ‐
88       enced by the values of offset and endian.
89
90
91
92   rsint8(), rsint16(), rsint32()
93       The ruint8(), ruint16(), and ruint32() functions work just as ruint8(),
94       ruint16(), and ruint32(), except they return signed integers.
95
96
97   ruint64(), rsint64()
98       The ruint64() and rsint64() functions read unsigned and signed  64  bit
99       integers  respectively from buf. Due to the limitations of ECMAScript's
100       Number type, they cannot be stored as one value without a loss of  pre‐
101       cision.  Instead  of returning the values as a single Number, the func‐
102       tions return an array of two numbers. The first entry  always  contains
103       the  upper 32-bits and the second value contains the lower 32-bits. The
104       lossy     transformation     into      a      number      would      be
105       res[0]*Math.pow(2,32)+res[1].  Note that, unless an entry is zero, both
106       array entries are guaranteed to have the same sign.
107
108
109   wuint8(), wuint16(), wuint32()
110       The functions wuint8(), wuint16(), and wuint32() modify the contents of
111       buf  by  writing  an 8, 16, and 32-bit unsigned integer respectively to
112       buf. It is illegal to pass a number that is not an integer  within  the
113       domain  of  the integer size, for example, for wuint8() the valid range
114       is [0, 255]. The value will be written in either big or  little  endian
115       format based upon the value of endian.
116
117
118
119   wsint8(), wsint16(), wsint32()
120       The  functions  wsint8(), wsint16(), and wsint32() function identically
121       to the functions wuint8(), wuint16(), and wuint32()  except  that  they
122       the  valid  domain  for  value is that of a signed number instead of an
123       unsigned number. For example the wsint8() has a domain of [-128, 127].
124
125
126   wuint64(), wsint64()
127       The functions wuint64() and swint64() write  out  64-bit  unsigned  and
128       signed  integers  to buf. The value argument must be in the same format
129       as described in ruint64() and rsint64().
130
131
132   rfloat(), rdouble()
133       The functions "rfloat() and rdouble()" work like the other  read  func‐
134       tions,  except  that  they read a single precision and double precision
135       IEEE-754 floating point value instead.
136
137
138   wfloat(), wdouble()
139       The functions "rfloat() and rdouble()" work like the other write  func‐
140       tions, except that the domain for a float is that of a single precision
141       4 byte value. The domain for a double  is  any  Number  in  ECMAScript,
142       which is defined to be represented by a double.
143
144

ATTRIBUTES

146       See attributes(5) for descriptions of the following attributes:
147
148
149
150
151       ┌────────────────────┬───────────────────┐
152       │  ATTRIBUTE TYPE    │  ATTRIBUTE VALUE  │
153       ├────────────────────┼───────────────────┤
154       │Interface Stability │ Committed         │
155       ├────────────────────┼───────────────────┤
156       │MT-Level            │ See below.        │
157       ├────────────────────┼───────────────────┤
158       │Standard            │ Not standardized. │
159       └────────────────────┴───────────────────┘
160
161
162       All  functions  are  MT-safe in so far as there aren't shared memory MT
163       concerns in most node programs. If one where to concoct such  an  envi‐
164       ronment, these functions wouldn't be MT-safe.
165
166

SEE ALSO

168                               December 12, 2011                  CTIO(3CTYPE)
Impressum