extra-bit.web 2.2.43 → 2.2.45
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.
- package/README.md +21 -17
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
The [bit] is a basic unit of information in information theory, computing.<br>
|
|
2
2
|
📦 [Node.js](https://www.npmjs.com/package/extra-bit),
|
|
3
3
|
🌐 [Web](https://www.npmjs.com/package/extra-bit.web),
|
|
4
4
|
📜 [Files](https://unpkg.com/extra-bit.web/),
|
|
5
5
|
📰 [Docs](https://nodef.github.io/extra-bit/),
|
|
6
6
|
📘 [Wiki](https://github.com/nodef/extra-bit/wiki/).
|
|
7
7
|
|
|
8
|
-
The
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
The concept of a **bit**, which stands for *binary digit*, has been a
|
|
9
|
+
fundamental unit of information in the fields of information theory and
|
|
10
|
+
computing. Bitwise operations are used to manipulate and process data at the bit
|
|
11
|
+
level, and these operations are *crucial for efficient programming* in a variety
|
|
12
|
+
of domains, such as computer graphics and cryptography. JavaScript converts a
|
|
13
|
+
`Number` (a *64-bit floating* *point number*) to a *32-bit integer* when bitwise
|
|
14
|
+
operators (such as `|`) are applied. All bitwise operations are performed on
|
|
15
|
+
**32-bit integers**. This package includes [bit twiddling hacks] by *Sean Eron*
|
|
16
|
+
*Anderson* and many others.
|
|
13
17
|
|
|
14
|
-
This package is available in *Node.js* and *Web* formats.
|
|
15
|
-
|
|
16
|
-
[jsDelivr CDN].
|
|
18
|
+
This package is available in *Node.js* and *Web* formats. To use it on the web,
|
|
19
|
+
simply use the `extra_bit` global variable after loading with a `<script>`
|
|
20
|
+
tag from the [jsDelivr CDN].
|
|
17
21
|
|
|
18
22
|
> Stability: [Experimental](https://www.youtube.com/watch?v=L1j93RnIxEo).
|
|
19
23
|
|
|
@@ -24,23 +28,23 @@ is exposed as `extra_bit` standalone variable and can be loaded from
|
|
|
24
28
|
<br>
|
|
25
29
|
|
|
26
30
|
```javascript
|
|
27
|
-
const
|
|
28
|
-
// import * as
|
|
29
|
-
// import * as
|
|
31
|
+
const xbit = require('extra-bit');
|
|
32
|
+
// import * as xbit from "extra-bit";
|
|
33
|
+
// import * as xbit from "https://unpkg.com/extra-bit/index.mjs"; (deno)
|
|
30
34
|
|
|
31
|
-
|
|
35
|
+
xbit.count(7);
|
|
32
36
|
// → 3 (111 ⇒ 3)
|
|
33
37
|
|
|
34
|
-
|
|
38
|
+
xbit.parity(8, 2);
|
|
35
39
|
// → 2 (10,00 ⇒ 10)
|
|
36
40
|
|
|
37
|
-
|
|
41
|
+
xbit.swap(6, 1, 0);
|
|
38
42
|
// → 5 (110 ⇒ 101)
|
|
39
43
|
|
|
40
|
-
|
|
44
|
+
xbit.reverse(0xFFFF0000);
|
|
41
45
|
// → 65535 (0x0000FFFF)
|
|
42
46
|
|
|
43
|
-
|
|
47
|
+
xbit.signExtend(15, 4);
|
|
44
48
|
// → -1
|
|
45
49
|
```
|
|
46
50
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "extra-bit.web",
|
|
3
|
-
"version": "2.2.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.2.45",
|
|
4
|
+
"description": "The bit is a basic unit of information in information theory, computing {web}.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"module": "index.mjs",
|