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