extra-bit 2.1.10 → 2.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.d.ts +48 -16
  2. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -1,103 +1,135 @@
1
1
  /**
2
2
  * Get bits at specified index.
3
+ * [📘](https://github.com/nodef/extra-bit/wiki/get)
3
4
  * @param x an int32
4
5
  * @param i bit index
5
6
  * @param w bit width (1)
6
- */
7
+ * */
8
+
7
9
  declare function get(x: number, i: number, w?: number): number;
8
10
  /**
9
11
  * Get bits as per mask.
12
+ * [📘](https://github.com/nodef/extra-bit/wiki/getAs)
10
13
  * @param x an int32
11
14
  * @param m bit mask
12
- */
15
+ * */
16
+
13
17
  declare function getAs(x: number, m: number): number;
14
18
  /**
15
19
  * Set bits at specified index.
20
+ * [📘](https://github.com/nodef/extra-bit/wiki/set)
16
21
  * @param x an int32
17
22
  * @param i bit index
18
23
  * @param v bit value (1)
19
24
  * @param w bit width (1)
20
- */
25
+ * */
26
+
21
27
  declare function set(x: number, i: number, v?: number, w?: number): number;
22
28
  /**
23
29
  * Set bits as per mask.
30
+ * [📘](https://github.com/nodef/extra-bit/wiki/setAs)
24
31
  * @param x an int32
25
32
  * @param m bit mask
26
33
  * @param f bit value (1)
27
- */
34
+ * */
35
+
28
36
  declare function setAs(x: number, m: number, f?: number): number;
29
37
  /**
30
38
  * Toggle bits at specified index.
39
+ * [📘](https://github.com/nodef/extra-bit/wiki/toggle)
31
40
  * @param x an int32
32
41
  * @param i bit index
33
42
  * @param w bit width (1)
34
- */
43
+ * */
44
+
35
45
  declare function toggle(x: number, i: number, w?: number): number;
36
46
  /**
37
47
  * Toggle bits as per mask.
48
+ * [📘](https://github.com/nodef/extra-bit/wiki/toggleAs)
38
49
  * @param x an int32
39
50
  * @param m bit mask
40
- */
51
+ * */
52
+
41
53
  declare function toggleAs(x: number, m: number): number;
42
54
  /**
43
55
  * Swap bit sequences at specified indices.
56
+ * [📘](https://github.com/nodef/extra-bit/wiki/swap)
44
57
  * @param x an int32
45
58
  * @param i first bit index
46
59
  * @param j second bit index
47
60
  * @param w bit width (1)
48
- */
61
+ * */
62
+
49
63
  declare function swap(x: number, i: number, j: number, w?: number): number;
50
64
  /**
51
65
  * Find index of first set bit from LSB.
66
+ * [📘](https://github.com/nodef/extra-bit/wiki/scan)
52
67
  * @param x an int32
53
- */
68
+ * */
69
+
54
70
  declare function scan(x: number): number;
55
71
  /**
56
72
  * Find index of first set bit from MSB.
73
+ * [📘](https://github.com/nodef/extra-bit/wiki/scanReverse)
57
74
  * @param x an int32
58
- */
75
+ * */
76
+
59
77
  declare function scanReverse(x: number): number;
60
78
  /**
61
79
  * Count bits set.
80
+ * [📘](https://github.com/nodef/extra-bit/wiki/count)
62
81
  * @param x an int32
63
- */
82
+ * */
83
+
64
84
  declare function count(x: number): number;
65
85
  /**
66
86
  * Calculate n-bit parity.
87
+ * [📘](https://github.com/nodef/extra-bit/wiki/parity)
67
88
  * @param x an int32
68
89
  * @param n number of bits (1)
69
- */
90
+ * */
91
+
70
92
  declare function parity(x: number, n?: number): number;
71
93
  /**
72
94
  * Rotate bits by a certain amount.
95
+ * [📘](https://github.com/nodef/extra-bit/wiki/rotate)
73
96
  * @param x an int32
74
97
  * @param n rotate amount (+ve: left, -ve: right)
75
- */
98
+ * */
99
+
76
100
  declare function rotate(x: number, n?: number): number;
77
101
  /**
78
102
  * Reverse all bits.
103
+ * [📘](https://github.com/nodef/extra-bit/wiki/reverse)
79
104
  * @param x an int32
80
- */
105
+ * */
106
+
81
107
  declare function reverse(x: number): number;
82
108
  /**
83
109
  * Merge bits as per mask.
110
+ * [📘](https://github.com/nodef/extra-bit/wiki/merge)
84
111
  * @param x first int32
85
112
  * @param y second int32
86
113
  * @param m bit mask (0 ⇒ from x)
87
- */
114
+ * */
115
+
88
116
  declare function merge(x: number, y: number, m: number): number;
89
117
  /**
90
118
  * Interleave bits of two int16s.
119
+ * [📘](https://github.com/nodef/extra-bit/wiki/interleave)
91
120
  * @param x first int16
92
121
  * @param y second int16
93
122
  * @returns int32
94
- */
123
+ * */
124
+
95
125
  declare function interleave(x: number, y: number): number;
96
126
  /**
97
127
  * Sign extend variable bit-width integer.
128
+ * [📘](https://github.com/nodef/extra-bit/wiki/signExtend)
98
129
  * @param x variable bit-width integer
99
130
  * @param w bit width (32)
100
- */
131
+ * */
132
+
101
133
  declare function signExtend(x: number, w?: number): number;
102
134
 
103
135
  export { count, get, getAs, interleave, merge, parity, reverse, rotate, scan, scanReverse, set, setAs, signExtend, swap, toggle, toggleAs };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "extra-bit",
3
- "version": "2.1.10",
3
+ "version": "2.1.11",
4
4
  "description": "A collection of common bitwise operations.",
5
5
  "sideEffects": false,
6
6
  "main": "index.js",
@@ -47,7 +47,7 @@
47
47
  "devDependencies": {
48
48
  "@rollup/plugin-commonjs": "^22.0.1",
49
49
  "@rollup/plugin-node-resolve": "^13.3.0",
50
- "extra-build": "^2.1.31",
50
+ "extra-build": "^2.2.3",
51
51
  "rollup-plugin-cleanup": "^3.2.1",
52
52
  "rollup-plugin-dts": "^4.2.2"
53
53
  }