~ubuntu-branches/ubuntu/karmic/ocaml-doc/karmic

« back to all changes in this revision

Viewing changes to ocaml.html/libref/Nativeint.html

  • Committer: Bazaar Package Importer
  • Author(s): Vanicat Rémi
  • Date: 2002-02-05 10:51:43 UTC
  • Revision ID: james.westby@ubuntu.com-20020205105143-a061tunf8tev07ne
Tags: 3.04-4
* New debian maintainer
* Split doc-base file
* Move to non-free
* Change the copyright file to the copyright of the documentation
* remove FAQs (their license prohibit their redistribution)
* corrected the examples

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<html>
 
2
<head>
 
3
<link rel="stylesheet" href="style.css" type="text/css">
 
4
<link rel="Start" href="index.html">
 
5
<link rel="previous" href="Mutex.html">
 
6
<link rel="next" href="Num.html">
 
7
<link rel="Up" href="index.html">
 
8
<link title="Index of types" rel="Appendix" href="index_types.html">
 
9
<link title="Index of exceptions" rel="Appendix" href="index_exceptions.html">
 
10
<link title="Index of values" rel="Appendix" href="index_values.html">
 
11
<link title="Index of class attributes" rel="Appendix" href="index_attributes.html">
 
12
<link title="Index of class methods" rel="Appendix" href="index_methods.html">
 
13
<link title="Index of classes" rel="Appendix" href="index_classes.html">
 
14
<link title="Index of class types" rel="Appendix" href="index_class_types.html">
 
15
<link title="Index of modules" rel="Appendix" href="index_modules.html">
 
16
<link title="Index of module types" rel="Appendix" href="index_module_types.html">
 
17
<link title="Arg" rel="Chapter" href="Arg.html">
 
18
 
 
19
<link title="Arith_status" rel="Chapter" href="Arith_status.html">
 
20
 
 
21
<link title="Array" rel="Chapter" href="Array.html">
 
22
 
 
23
<link title="ArrayLabels" rel="Chapter" href="ArrayLabels.html">
 
24
 
 
25
<link title="Big_int" rel="Chapter" href="Big_int.html">
 
26
 
 
27
<link title="Bigarray" rel="Chapter" href="Bigarray.html">
 
28
 
 
29
<link title="Buffer" rel="Chapter" href="Buffer.html">
 
30
 
 
31
<link title="Callback" rel="Chapter" href="Callback.html">
 
32
 
 
33
<link title="Char" rel="Chapter" href="Char.html">
 
34
 
 
35
<link title="Condition" rel="Chapter" href="Condition.html">
 
36
 
 
37
<link title="Dbm" rel="Chapter" href="Dbm.html">
 
38
 
 
39
<link title="Digest" rel="Chapter" href="Digest.html">
 
40
 
 
41
<link title="Dynlink" rel="Chapter" href="Dynlink.html">
 
42
 
 
43
<link title="Event" rel="Chapter" href="Event.html">
 
44
 
 
45
<link title="Filename" rel="Chapter" href="Filename.html">
 
46
 
 
47
<link title="Format" rel="Chapter" href="Format.html">
 
48
 
 
49
<link title="Gc" rel="Chapter" href="Gc.html">
 
50
 
 
51
<link title="Genlex" rel="Chapter" href="Genlex.html">
 
52
 
 
53
<link title="Graphics" rel="Chapter" href="Graphics.html">
 
54
 
 
55
<link title="GraphicsX11" rel="Chapter" href="GraphicsX11.html">
 
56
 
 
57
<link title="Hashtbl" rel="Chapter" href="Hashtbl.html">
 
58
 
 
59
<link title="Int32" rel="Chapter" href="Int32.html">
 
60
 
 
61
<link title="Int64" rel="Chapter" href="Int64.html">
 
62
 
 
63
<link title="Lazy" rel="Chapter" href="Lazy.html">
 
64
 
 
65
<link title="Lexing" rel="Chapter" href="Lexing.html">
 
66
 
 
67
<link title="List" rel="Chapter" href="List.html">
 
68
 
 
69
<link title="ListLabels" rel="Chapter" href="ListLabels.html">
 
70
 
 
71
<link title="Map" rel="Chapter" href="Map.html">
 
72
 
 
73
<link title="Marshal" rel="Chapter" href="Marshal.html">
 
74
 
 
75
<link title="MoreLabels" rel="Chapter" href="MoreLabels.html">
 
76
 
 
77
<link title="Mutex" rel="Chapter" href="Mutex.html">
 
78
 
 
79
<link title="Nativeint" rel="Chapter" href="Nativeint.html">
 
80
 
 
81
<link title="Num" rel="Chapter" href="Num.html">
 
82
 
 
83
<link title="Obj" rel="Chapter" href="Obj.html">
 
84
 
 
85
<link title="Oo" rel="Chapter" href="Oo.html">
 
86
 
 
87
<link title="Parsing" rel="Chapter" href="Parsing.html">
 
88
 
 
89
<link title="Pervasives" rel="Chapter" href="Pervasives.html">
 
90
 
 
91
<link title="Printexc" rel="Chapter" href="Printexc.html">
 
92
 
 
93
<link title="Printf" rel="Chapter" href="Printf.html">
 
94
 
 
95
<link title="Queue" rel="Chapter" href="Queue.html">
 
96
 
 
97
<link title="Random" rel="Chapter" href="Random.html">
 
98
 
 
99
<link title="Set" rel="Chapter" href="Set.html">
 
100
 
 
101
<link title="Sort" rel="Chapter" href="Sort.html">
 
102
 
 
103
<link title="Stack" rel="Chapter" href="Stack.html">
 
104
 
 
105
<link title="StdLabels" rel="Chapter" href="StdLabels.html">
 
106
 
 
107
<link title="Str" rel="Chapter" href="Str.html">
 
108
 
 
109
<link title="Stream" rel="Chapter" href="Stream.html">
 
110
 
 
111
<link title="String" rel="Chapter" href="String.html">
 
112
 
 
113
<link title="StringLabels" rel="Chapter" href="StringLabels.html">
 
114
 
 
115
<link title="Sys" rel="Chapter" href="Sys.html">
 
116
 
 
117
<link title="Thread" rel="Chapter" href="Thread.html">
 
118
 
 
119
<link title="ThreadUnix" rel="Chapter" href="ThreadUnix.html">
 
120
 
 
121
<link title="Tk" rel="Chapter" href="Tk.html">
 
122
 
 
123
<link title="Unix" rel="Chapter" href="Unix.html">
 
124
 
 
125
<link title="UnixLabels" rel="Chapter" href="UnixLabels.html">
 
126
 
 
127
<link title="Weak" rel="Chapter" href="Weak.html">
 
128
<title>Nativeint</title>
 
129
</head>
 
130
<body>
 
131
<div class="navbar"><a href="Mutex.html">Previous</a>
 
132
&nbsp;<a href="index.html">Up</a>
 
133
&nbsp;<a href="Num.html">Next</a>
 
134
</div>
 
135
<center><h1>Module <a href="type_Nativeint.html">Nativeint</a></h1></center>
 
136
<br>
 
137
<pre><span class="keyword">module</span> Nativeint = <code><span class="keyword">struct</span> ... <span class="keyword">end</span> </code></pre><div class="info">
 
138
Processor-native integers.<br>
 
139
   This module provides operations on the type <code>nativeint</code> of
 
140
   signed 32-bit integers (on 32-bit platforms) or
 
141
   signed 64-bit integers (on 64-bit platforms).
 
142
   This integer type has exactly the same width as that of a <code>long</code>
 
143
   integer type in the C compiler.  All arithmetic operations over
 
144
   <code>nativeint</code> are taken modulo 2<sup class="superscript">32</sup> or 2<sup class="superscript">64</sup> depending
 
145
   on the word size of the architecture.<br>
 
146
   Performance notice: values of type <code>nativeint</code> occupy more memory
 
147
   space than values of type <code>int</code>, and arithmetic operations on
 
148
   <code>nativeint</code> are generally slower than those on <code>int</code>.  Use <code>nativeint</code>
 
149
   only when the application requires the extra bit of precision
 
150
   over the <code>int</code> type.<br>
 
151
</div>
 
152
<hr width="100%">
 
153
<pre><span class="keyword">val</span> <a name="VALzero"></a>zero : <code class="type">nativeint</code></pre><div class="info">
 
154
The native integer 0.<br>
 
155
</div>
 
156
<pre><span class="keyword">val</span> <a name="VALone"></a>one : <code class="type">nativeint</code></pre><div class="info">
 
157
The native integer 1.<br>
 
158
</div>
 
159
<pre><span class="keyword">val</span> <a name="VALminus_one"></a>minus_one : <code class="type">nativeint</code></pre><div class="info">
 
160
The native integer -1.<br>
 
161
</div>
 
162
<pre><span class="keyword">val</span> <a name="VALneg"></a>neg : <code class="type">nativeint -> nativeint</code></pre><div class="info">
 
163
Unary negation.<br>
 
164
</div>
 
165
<pre><span class="keyword">val</span> <a name="VALadd"></a>add : <code class="type">nativeint -> nativeint -> nativeint</code></pre><div class="info">
 
166
Addition.<br>
 
167
</div>
 
168
<pre><span class="keyword">val</span> <a name="VALsub"></a>sub : <code class="type">nativeint -> nativeint -> nativeint</code></pre><div class="info">
 
169
Subtraction.<br>
 
170
</div>
 
171
<pre><span class="keyword">val</span> <a name="VALmul"></a>mul : <code class="type">nativeint -> nativeint -> nativeint</code></pre><div class="info">
 
172
Multiplication.<br>
 
173
</div>
 
174
<pre><span class="keyword">val</span> <a name="VALdiv"></a>div : <code class="type">nativeint -> nativeint -> nativeint</code></pre><div class="info">
 
175
Integer division.  Raise <code><span class="constructor">Division_by_zero</span></code> if the second 
 
176
   argument is zero.<br>
 
177
</div>
 
178
<pre><span class="keyword">val</span> <a name="VALrem"></a>rem : <code class="type">nativeint -> nativeint -> nativeint</code></pre><div class="info">
 
179
Integer remainder.  If <code>x &gt;= 0</code> and <code>y &gt; 0</code>, the result
 
180
   of <code><span class="constructor">Nativeint</span>.rem x y</code> satisfies the following properties:
 
181
   <code>0 &lt;= <span class="constructor">Nativeint</span>.rem x y &lt; y</code> and
 
182
   <code>x = <span class="constructor">Nativeint</span>.add (<span class="constructor">Nativeint</span>.mul (<span class="constructor">Nativeint</span>.div x y) y) (<span class="constructor">Nativeint</span>.rem x y)</code>.
 
183
   If <code>y = 0</code>, <code><span class="constructor">Nativeint</span>.rem x y</code> raises <code><span class="constructor">Division_by_zero</span></code>.
 
184
   If <code>x &lt; 0</code> or <code>y &lt; 0</code>, the result of <code><span class="constructor">Nativeint</span>.rem x y</code> is
 
185
   not specified and depends on the platform.<br>
 
186
</div>
 
187
<pre><span class="keyword">val</span> <a name="VALsucc"></a>succ : <code class="type">nativeint -> nativeint</code></pre><div class="info">
 
188
Successor.
 
189
   <code><span class="constructor">Nativeint</span>.succ x</code> is <code><span class="constructor">Nativeint</span>.add x <span class="constructor">Nativeint</span>.one</code>.<br>
 
190
</div>
 
191
<pre><span class="keyword">val</span> <a name="VALpred"></a>pred : <code class="type">nativeint -> nativeint</code></pre><div class="info">
 
192
Predecessor.
 
193
   <code><span class="constructor">Nativeint</span>.pred x</code> is <code><span class="constructor">Nativeint</span>.sub x <span class="constructor">Nativeint</span>.one</code>.<br>
 
194
</div>
 
195
<pre><span class="keyword">val</span> <a name="VALabs"></a>abs : <code class="type">nativeint -> nativeint</code></pre><div class="info">
 
196
Return the absolute value of its argument.<br>
 
197
</div>
 
198
<pre><span class="keyword">val</span> <a name="VALsize"></a>size : <code class="type">int</code></pre><div class="info">
 
199
The size in bits of a native integer.  This is equal to <code>32</code>
 
200
   on a 32-bit platform and to <code>64</code> on a 64-bit platform.<br>
 
201
</div>
 
202
<pre><span class="keyword">val</span> <a name="VALmax_int"></a>max_int : <code class="type">nativeint</code></pre><div class="info">
 
203
The greatest representable native integer,
 
204
   either 2<sup class="superscript">31</sup> - 1 on a 32-bit platform,
 
205
   or 2<sup class="superscript">63</sup> - 1 on a 64-bit platform.<br>
 
206
</div>
 
207
<pre><span class="keyword">val</span> <a name="VALmin_int"></a>min_int : <code class="type">nativeint</code></pre><div class="info">
 
208
The greatest representable native integer,
 
209
   either -2<sup class="superscript">31</sup> on a 32-bit platform,
 
210
   or -2<sup class="superscript">63</sup> on a 64-bit platform.<br>
 
211
</div>
 
212
<pre><span class="keyword">val</span> <a name="VALlogand"></a>logand : <code class="type">nativeint -> nativeint -> nativeint</code></pre><div class="info">
 
213
Bitwise logical and.<br>
 
214
</div>
 
215
<pre><span class="keyword">val</span> <a name="VALlogor"></a>logor : <code class="type">nativeint -> nativeint -> nativeint</code></pre><div class="info">
 
216
Bitwise logical or.<br>
 
217
</div>
 
218
<pre><span class="keyword">val</span> <a name="VALlogxor"></a>logxor : <code class="type">nativeint -> nativeint -> nativeint</code></pre><div class="info">
 
219
Bitwise logical exclusive or.<br>
 
220
</div>
 
221
<pre><span class="keyword">val</span> <a name="VALlognot"></a>lognot : <code class="type">nativeint -> nativeint</code></pre><div class="info">
 
222
Bitwise logical negation<br>
 
223
</div>
 
224
<pre><span class="keyword">val</span> <a name="VALshift_left"></a>shift_left : <code class="type">nativeint -> int -> nativeint</code></pre><div class="info">
 
225
<code><span class="constructor">Nativeint</span>.shift_left x y</code> shifts <code>x</code> to the left by <code>y</code> bits.
 
226
   The result is unspecified if <code>y &lt; 0</code> or <code>y &gt;= bitsize</code>,
 
227
   where <code>bitsize</code> is <code>32</code> on a 32-bit platform and
 
228
   <code>64</code> on a 64-bit platform.<br>
 
229
</div>
 
230
<pre><span class="keyword">val</span> <a name="VALshift_right"></a>shift_right : <code class="type">nativeint -> int -> nativeint</code></pre><div class="info">
 
231
<code><span class="constructor">Nativeint</span>.shift_right x y</code> shifts <code>x</code> to the right by <code>y</code> bits.
 
232
   This is an arithmetic shift: the sign bit of <code>x</code> is replicated
 
233
   and inserted in the vacated bits.
 
234
   The result is unspecified if <code>y &lt; 0</code> or <code>y &gt;= bitsize</code>.<br>
 
235
</div>
 
236
<pre><span class="keyword">val</span> <a name="VALshift_right_logical"></a>shift_right_logical : <code class="type">nativeint -> int -> nativeint</code></pre><div class="info">
 
237
<code><span class="constructor">Nativeint</span>.shift_right_logical x y</code> shifts <code>x</code> to the right
 
238
   by <code>y</code> bits.
 
239
   This is a logical shift: zeroes are inserted in the vacated bits
 
240
   regardless of the sign of <code>x</code>.
 
241
   The result is unspecified if <code>y &lt; 0</code> or <code>y &gt;= bitsize</code>.<br>
 
242
</div>
 
243
<pre><span class="keyword">val</span> <a name="VALof_int"></a>of_int : <code class="type">int -> nativeint</code></pre><div class="info">
 
244
Convert the given integer (type <code>int</code>) to a native integer
 
245
   (type <code>nativeint</code>).<br>
 
246
</div>
 
247
<pre><span class="keyword">val</span> <a name="VALto_int"></a>to_int : <code class="type">nativeint -> int</code></pre><div class="info">
 
248
Convert the given native integer (type <code>nativeint</code>) to an
 
249
   integer (type <code>int</code>).  The high-order bit is lost during
 
250
   the conversion.<br>
 
251
</div>
 
252
<pre><span class="keyword">val</span> <a name="VALof_float"></a>of_float : <code class="type">float -> nativeint</code></pre><div class="info">
 
253
Convert the given floating-point number to a native integer,
 
254
   discarding the fractional part (truncate towards 0).
 
255
   The result of the conversion is undefined if, after truncation,
 
256
   the number is outside the range
 
257
   [<a href="Nativeint.html#VALmin_int"><code><span class="constructor">Nativeint</span>.min_int</code></a>, <a href="Nativeint.html#VALmax_int"><code><span class="constructor">Nativeint</span>.max_int</code></a>].<br>
 
258
</div>
 
259
<pre><span class="keyword">val</span> <a name="VALto_float"></a>to_float : <code class="type">nativeint -> float</code></pre><div class="info">
 
260
Convert the given native integer to a floating-point number.<br>
 
261
</div>
 
262
<pre><span class="keyword">val</span> <a name="VALof_int32"></a>of_int32 : <code class="type">int32 -> nativeint</code></pre><div class="info">
 
263
Convert the given 32-bit integer (type <code>int32</code>)
 
264
   to a native integer.<br>
 
265
</div>
 
266
<pre><span class="keyword">val</span> <a name="VALto_int32"></a>to_int32 : <code class="type">nativeint -> int32</code></pre><div class="info">
 
267
Convert the given native integer to a
 
268
   32-bit integer (type <code>int32</code>).  On 64-bit platforms,
 
269
   the 64-bit native integer is taken modulo 2<sup class="superscript">32</sup>,
 
270
   i.e. the top 32 bits are lost.  On 32-bit platforms,
 
271
   the conversion is exact.<br>
 
272
</div>
 
273
<pre><span class="keyword">val</span> <a name="VALof_string"></a>of_string : <code class="type">string -> nativeint</code></pre><div class="info">
 
274
Convert the given string to a native integer.
 
275
   The string is read in decimal (by default) or in hexadecimal,
 
276
   octal or binary if the string begins with <code>0x</code>, <code>0o</code> or <code>0b</code>
 
277
   respectively.
 
278
   Raise <code><span class="constructor">Failure</span> <span class="string">"int_of_string"</span></code> if the given string is not
 
279
   a valid representation of an integer.<br>
 
280
</div>
 
281
<pre><span class="keyword">val</span> <a name="VALto_string"></a>to_string : <code class="type">nativeint -> string</code></pre><div class="info">
 
282
Return the string representation of its argument, in decimal.<br>
 
283
</div>
 
284
<pre><span class="keyword">val</span> <a name="VALformat"></a>format : <code class="type">string -> nativeint -> string</code></pre><div class="info">
 
285
<code><span class="constructor">Nativeint</span>.format fmt n</code> return the string representation of the
 
286
   native integer <code>n</code> in the format specified by <code>fmt</code>.
 
287
   <code>fmt</code> is a <code><span class="constructor">Printf</span></code>-style format containing exactly
 
288
   one <code>%d</code>, <code>%i</code>, <code>%u</code>, <code>%x</code>, <code>%<span class="constructor">X</span></code> or <code>%o</code> conversion specification.
 
289
   This function is deprecated; use <a href="Printf.html#VALsprintf"><code><span class="constructor">Printf</span>.sprintf</code></a> with a <code>%nx</code> format
 
290
   instead.<br>
 
291
</div>
 
292
</html>
 
 
b'\\ No newline at end of file'