luci-base: add luci.sys.net.host_hints() and regenerate documentation
[project/luci.git] / documentation / api / modules / nixio.bit.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html>
4 <head>
5     <title>Reference</title>
6     <link rel="stylesheet" href="../luadoc.css" type="text/css" />
7         <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/-->
8 </head>
9
10 <body>
11 <div id="container">
12
13 <div id="product">
14         <div id="product_logo"></div>
15         <div id="product_name"><big><b></b></big></div>
16         <div id="product_description"></div>
17 </div> <!-- id="product" -->
18
19 <div id="main">
20
21 <div id="navigation">
22
23
24 <h1>LuaDoc</h1>
25 <ul>
26         
27         <li><a href="../index.html">Index</a></li>
28         
29 </ul>
30
31
32 <!-- Module list -->
33
34 <h1>Modules</h1>
35 <ul>
36
37         <li>
38                 <a href="../modules/luci.dispatcher.html">luci.dispatcher</a>
39         </li>
40
41         <li>
42                 <a href="../modules/luci.http.html">luci.http</a>
43         </li>
44
45         <li>
46                 <a href="../modules/luci.http.protocol.html">luci.http.protocol</a>
47         </li>
48
49         <li>
50                 <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a>
51         </li>
52
53         <li>
54                 <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a>
55         </li>
56
57         <li>
58                 <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a>
59         </li>
60
61         <li>
62                 <a href="../modules/luci.i18n.html">luci.i18n</a>
63         </li>
64
65         <li>
66                 <a href="../modules/luci.ip.html">luci.ip</a>
67         </li>
68
69         <li>
70                 <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a>
71         </li>
72
73         <li>
74                 <a href="../modules/luci.json.html">luci.json</a>
75         </li>
76
77         <li>
78                 <a href="../modules/luci.jsonc.html">luci.jsonc</a>
79         </li>
80
81         <li>
82                 <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a>
83         </li>
84
85         <li>
86                 <a href="../modules/luci.model.ipkg.html">luci.model.ipkg</a>
87         </li>
88
89         <li>
90                 <a href="../modules/luci.model.uci.html">luci.model.uci</a>
91         </li>
92
93         <li>
94                 <a href="../modules/luci.rpcc.html">luci.rpcc</a>
95         </li>
96
97         <li>
98                 <a href="../modules/luci.rpcc.ruci.html">luci.rpcc.ruci</a>
99         </li>
100
101         <li>
102                 <a href="../modules/luci.sys.html">luci.sys</a>
103         </li>
104
105         <li>
106                 <a href="../modules/luci.sys.init.html">luci.sys.init</a>
107         </li>
108
109         <li>
110                 <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a>
111         </li>
112
113         <li>
114                 <a href="../modules/luci.sys.net.html">luci.sys.net</a>
115         </li>
116
117         <li>
118                 <a href="../modules/luci.sys.process.html">luci.sys.process</a>
119         </li>
120
121         <li>
122                 <a href="../modules/luci.sys.user.html">luci.sys.user</a>
123         </li>
124
125         <li>
126                 <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a>
127         </li>
128
129         <li>
130                 <a href="../modules/luci.util.html">luci.util</a>
131         </li>
132
133         <li>
134                 <a href="../modules/nixio.html">nixio</a>
135         </li>
136
137         <li>
138                 <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a>
139         </li>
140
141         <li>
142                 <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a>
143         </li>
144
145         <li>
146                 <a href="../modules/nixio.File.html">nixio.File</a>
147         </li>
148
149         <li>
150                 <a href="../modules/nixio.README.html">nixio.README</a>
151         </li>
152
153         <li>
154                 <a href="../modules/nixio.Socket.html">nixio.Socket</a>
155         </li>
156
157         <li>
158                 <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a>
159         </li>
160
161         <li>
162                 <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a>
163         </li>
164
165         <li>
166                 <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a>
167         </li>
168
169         <li>
170                 <a href="../modules/nixio.bin.html">nixio.bin</a>
171         </li>
172
173         <li><strong>nixio.bit</strong></li>
174         
175         <li>
176                 <a href="../modules/nixio.crypto.html">nixio.crypto</a>
177         </li>
178
179         <li>
180                 <a href="../modules/nixio.fs.html">nixio.fs</a>
181         </li>
182
183 </ul>
184
185
186
187 <!-- File list -->
188
189
190
191
192
193
194
195 </div><!-- id="navigation" -->
196
197 <div id="content">
198
199 <h1>Class <code>nixio.bit</code></h1>
200
201 <p>
202  Bitfield operators and mainpulation functions. 
203  Can be used as a drop-in replacement for bitlib.</p>
204
205
206
207
208
209
210
211 <h2>Functions</h2>
212 <table class="function_list">
213
214         <tr>
215         <td class="name" nowrap><a href="#arshift">arshift</a>&nbsp;(oper, shift)</td>
216         <td class="summary">
217  Arithmetically right shift a number.</td>
218         </tr>
219
220         <tr>
221         <td class="name" nowrap><a href="#band">band</a>&nbsp;(oper1, oper2, ...)</td>
222         <td class="summary">
223  Bitwise AND several numbers.</td>
224         </tr>
225
226         <tr>
227         <td class="name" nowrap><a href="#bnot">bnot</a>&nbsp;(oper)</td>
228         <td class="summary">
229  Invert given number.</td>
230         </tr>
231
232         <tr>
233         <td class="name" nowrap><a href="#bor">bor</a>&nbsp;(oper1, oper2, ...)</td>
234         <td class="summary">
235  Bitwise OR several numbers.</td>
236         </tr>
237
238         <tr>
239         <td class="name" nowrap><a href="#bxor">bxor</a>&nbsp;(oper1, oper2, ...)</td>
240         <td class="summary">
241  Bitwise XOR several numbers.</td>
242         </tr>
243
244         <tr>
245         <td class="name" nowrap><a href="#cast">cast</a>&nbsp;(oper)</td>
246         <td class="summary">
247  Cast a number to the bit-operating range.</td>
248         </tr>
249
250         <tr>
251         <td class="name" nowrap><a href="#check">check</a>&nbsp;(bitfield, flag1, ...)</td>
252         <td class="summary">
253  Checks whether given flags are set in a bitfield.</td>
254         </tr>
255
256         <tr>
257         <td class="name" nowrap><a href="#div">div</a>&nbsp;(oper1, oper2, ...)</td>
258         <td class="summary">
259  Integer division of 2 or more numbers.</td>
260         </tr>
261
262         <tr>
263         <td class="name" nowrap><a href="#lshift">lshift</a>&nbsp;(oper, shift)</td>
264         <td class="summary">
265  Left shift a number.</td>
266         </tr>
267
268         <tr>
269         <td class="name" nowrap><a href="#rshift">rshift</a>&nbsp;(oper, shift)</td>
270         <td class="summary">
271  Right shift a number.</td>
272         </tr>
273
274         <tr>
275         <td class="name" nowrap><a href="#set">set</a>&nbsp;(bitfield, flag1, ...)</td>
276         <td class="summary">
277  Sets one or more flags of a bitfield.</td>
278         </tr>
279
280         <tr>
281         <td class="name" nowrap><a href="#unset">unset</a>&nbsp;(bitfield, flag1, ...)</td>
282         <td class="summary">
283  Unsets one or more flags of a bitfield.</td>
284         </tr>
285
286 </table>
287
288
289
290
291
292
293 <br/>
294 <br/>
295
296
297 <h2><a name="functions"></a>Functions</h2>
298 <dl class="function">
299
300
301
302 <dt><a name="arshift"></a><strong>arshift</strong>&nbsp;(oper, shift)</dt>
303 <dd>
304
305  Arithmetically right shift a number.
306
307
308 <h3>Parameters</h3>
309 <ul>
310         
311         <li>
312           oper: number
313         </li>
314         
315         <li>
316           shift: bits to shift 
317         </li>
318         
319 </ul>
320
321
322
323
324
325
326 <h3>Return value:</h3>
327 number
328
329
330
331 </dd>
332
333
334
335
336 <dt><a name="band"></a><strong>band</strong>&nbsp;(oper1, oper2, ...)</dt>
337 <dd>
338
339  Bitwise AND several numbers.
340
341
342 <h3>Parameters</h3>
343 <ul>
344         
345         <li>
346           oper1: First Operand
347         </li>
348         
349         <li>
350           oper2: Second Operand
351         </li>
352         
353         <li>
354           ...: More Operands
355         </li>
356         
357 </ul>
358
359
360
361
362
363
364 <h3>Return value:</h3>
365 number
366
367
368
369 </dd>
370
371
372
373
374 <dt><a name="bnot"></a><strong>bnot</strong>&nbsp;(oper)</dt>
375 <dd>
376
377  Invert given number.
378
379
380 <h3>Parameters</h3>
381 <ul>
382         
383         <li>
384           oper: Operand
385         </li>
386         
387 </ul>
388
389
390
391
392
393
394 <h3>Return value:</h3>
395 number
396
397
398
399 </dd>
400
401
402
403
404 <dt><a name="bor"></a><strong>bor</strong>&nbsp;(oper1, oper2, ...)</dt>
405 <dd>
406
407  Bitwise OR several numbers.
408
409
410 <h3>Parameters</h3>
411 <ul>
412         
413         <li>
414           oper1: First Operand
415         </li>
416         
417         <li>
418           oper2: Second Operand
419         </li>
420         
421         <li>
422           ...: More Operands
423         </li>
424         
425 </ul>
426
427
428
429
430
431
432 <h3>Return value:</h3>
433 number
434
435
436
437 </dd>
438
439
440
441
442 <dt><a name="bxor"></a><strong>bxor</strong>&nbsp;(oper1, oper2, ...)</dt>
443 <dd>
444
445  Bitwise XOR several numbers.
446
447
448 <h3>Parameters</h3>
449 <ul>
450         
451         <li>
452           oper1: First Operand
453         </li>
454         
455         <li>
456           oper2: Second Operand
457         </li>
458         
459         <li>
460           ...: More Operands
461         </li>
462         
463 </ul>
464
465
466
467
468
469
470 <h3>Return value:</h3>
471 number
472
473
474
475 </dd>
476
477
478
479
480 <dt><a name="cast"></a><strong>cast</strong>&nbsp;(oper)</dt>
481 <dd>
482
483  Cast a number to the bit-operating range.
484
485
486 <h3>Parameters</h3>
487 <ul>
488         
489         <li>
490           oper: number
491         </li>
492         
493 </ul>
494
495
496
497
498
499
500 <h3>Return value:</h3>
501 number
502
503
504
505 </dd>
506
507
508
509
510 <dt><a name="check"></a><strong>check</strong>&nbsp;(bitfield, flag1, ...)</dt>
511 <dd>
512
513  Checks whether given flags are set in a bitfield.
514
515
516 <h3>Parameters</h3>
517 <ul>
518         
519         <li>
520           bitfield: Bitfield
521         </li>
522         
523         <li>
524           flag1: First Flag
525         </li>
526         
527         <li>
528           ...: More Flags
529         </li>
530         
531 </ul>
532
533
534
535
536
537
538 <h3>Return value:</h3>
539 true when all flags are set, otherwise false
540
541
542
543 </dd>
544
545
546
547
548 <dt><a name="div"></a><strong>div</strong>&nbsp;(oper1, oper2, ...)</dt>
549 <dd>
550
551  Integer division of 2 or more numbers.
552
553
554 <h3>Parameters</h3>
555 <ul>
556         
557         <li>
558           oper1: Operand 1
559         </li>
560         
561         <li>
562           oper2: Operand 2
563         </li>
564         
565         <li>
566           ...: More Operands
567         </li>
568         
569 </ul>
570
571
572
573
574
575
576 <h3>Return value:</h3>
577 number
578
579
580
581 </dd>
582
583
584
585
586 <dt><a name="lshift"></a><strong>lshift</strong>&nbsp;(oper, shift)</dt>
587 <dd>
588
589  Left shift a number.
590
591
592 <h3>Parameters</h3>
593 <ul>
594         
595         <li>
596           oper: number
597         </li>
598         
599         <li>
600           shift: bits to shift 
601         </li>
602         
603 </ul>
604
605
606
607
608
609
610 <h3>Return value:</h3>
611 number
612
613
614
615 </dd>
616
617
618
619
620 <dt><a name="rshift"></a><strong>rshift</strong>&nbsp;(oper, shift)</dt>
621 <dd>
622
623  Right shift a number.
624
625
626 <h3>Parameters</h3>
627 <ul>
628         
629         <li>
630           oper: number
631         </li>
632         
633         <li>
634           shift: bits to shift 
635         </li>
636         
637 </ul>
638
639
640
641
642
643
644 <h3>Return value:</h3>
645 number
646
647
648
649 </dd>
650
651
652
653
654 <dt><a name="set"></a><strong>set</strong>&nbsp;(bitfield, flag1, ...)</dt>
655 <dd>
656
657  Sets one or more flags of a bitfield.
658
659
660 <h3>Parameters</h3>
661 <ul>
662         
663         <li>
664           bitfield: Bitfield
665         </li>
666         
667         <li>
668           flag1: First Flag
669         </li>
670         
671         <li>
672           ...: More Flags
673         </li>
674         
675 </ul>
676
677
678
679
680
681
682 <h3>Return value:</h3>
683 altered bitfield
684
685
686
687 </dd>
688
689
690
691
692 <dt><a name="unset"></a><strong>unset</strong>&nbsp;(bitfield, flag1, ...)</dt>
693 <dd>
694
695  Unsets one or more flags of a bitfield.
696
697
698 <h3>Parameters</h3>
699 <ul>
700         
701         <li>
702           bitfield: Bitfield
703         </li>
704         
705         <li>
706           flag1: First Flag
707         </li>
708         
709         <li>
710           ...: More Flags
711         </li>
712         
713 </ul>
714
715
716
717
718
719
720 <h3>Return value:</h3>
721 altered bitfield
722
723
724
725 </dd>
726
727
728 </dl>
729
730
731
732
733
734 </div> <!-- id="content" -->
735
736 </div> <!-- id="main" -->
737
738 <div id="about">
739         <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p>
740 </div> <!-- id="about" -->
741
742 </div> <!-- id="container" -->
743 </body>
744 </html>