Skip to content

Commit fb4a2ae

Browse files
committed
Add auto-generated API reference.
1 parent e65cd84 commit fb4a2ae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+19701
-2
lines changed

docs/api/_category_.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"label": "API",
3+
"position": 5,
4+
"link": {
5+
"type": "generated-index",
6+
"description": "Auto-generated Reference for Pragtical API."
7+
}
8+
}

docs/api/bit.md

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
---
2+
sidebar_position: 2
3+
---
4+
5+
<!-- DO NOT EDIT: file generated with `pragtical gendocs` -->
6+
# bit
7+
8+
Mike Pall bit operations library included on every Lua runtime for
9+
consistency with the patch https://github.com/LuaJIT/LuaJIT/issues/384
10+
applied for newer Lua versions support.
11+
12+
See: https://bitop.luajit.org/
13+
14+
## arshift
15+
16+
```lua
17+
function bit.arshift(x: integer, n: integer)
18+
-> y: integer
19+
```
20+
21+
Returns either the bitwise logical arithmetic right-shift of its first
22+
argument by the number of bits given by the second argument.
23+
24+
---
25+
26+
## band
27+
28+
```lua
29+
function bit.band(x: integer, x2: integer, ...integer)
30+
-> y: integer
31+
```
32+
33+
Returns the bitwise `and` of all of its arguments.
34+
35+
---
36+
37+
## bnot
38+
39+
```lua
40+
function bit.bnot(x: integer)
41+
-> y: integer
42+
```
43+
44+
Returns the bitwise `not` of its argument.
45+
46+
---
47+
48+
## bor
49+
50+
```lua
51+
function bit.bor(x: integer, x2: integer, ...integer)
52+
-> y: integer
53+
```
54+
55+
Returns the bitwise `or` of all of its arguments.
56+
57+
---
58+
59+
## bswap
60+
61+
```lua
62+
function bit.bswap(x: integer)
63+
-> y: integer
64+
```
65+
66+
Swaps the bytes of its argument and returns it. This can be used to
67+
convert little-endian 32 bit numbers to big-endian 32 bit numbers or
68+
vice versa.
69+
70+
---
71+
72+
## bxor
73+
74+
```lua
75+
function bit.bxor(x: integer, x2: integer, ...integer)
76+
-> y: integer
77+
```
78+
79+
Returns the bitwise `xor` of all of its arguments.
80+
81+
---
82+
83+
## lshift
84+
85+
```lua
86+
function bit.lshift(x: integer, n: integer)
87+
-> y: integer
88+
```
89+
90+
Returns either the bitwise logical left-shift of its first argument by the
91+
number of bits given by the second argument.
92+
93+
---
94+
95+
## rol
96+
97+
```lua
98+
function bit.rol(x: integer, n: integer)
99+
-> y: integer
100+
```
101+
102+
Returns the bitwise left rotation of its first argument by the number of
103+
bits given by the second argument. Bits shifted out on one side are
104+
shifted back in on the other side.
105+
106+
---
107+
108+
## ror
109+
110+
```lua
111+
function bit.ror(x: integer, n: integer)
112+
-> y: integer
113+
```
114+
115+
Returns the bitwise right rotation of its first argument by the number of
116+
bits given by the second argument. Bits shifted out on one side are
117+
shifted back in on the other side.
118+
119+
---
120+
121+
## rshift
122+
123+
```lua
124+
function bit.rshift(x: integer, n: integer)
125+
-> y: integer
126+
```
127+
128+
Returns either the bitwise logical right-shift of its first argument by the
129+
number of bits given by the second argument.
130+
131+
---
132+
133+
## tobit
134+
135+
```lua
136+
function bit.tobit(x: integer)
137+
-> y: integer
138+
```
139+
140+
Normalizes a number to the numeric range for bit operations and returns it.
141+
This function is usually not needed since all bit operations already
142+
normalize all of their input arguments.
143+
144+
---
145+
146+
## tohex
147+
148+
```lua
149+
function bit.tohex(x: integer, n?: integer)
150+
-> y: integer
151+
```
152+
153+
Converts its first argument to a hex string. The number of hex digits is
154+
given by the absolute value of the optional second argument. Positive
155+
numbers between 1 and 8 generate lowercase hex digits. Negative numbers
156+
generate uppercase hex digits. Only the least-significant 4*|n| bits are
157+
used. The default is to generate 8 lowercase hex digits.
158+
159+
---
160+

0 commit comments

Comments
 (0)