UNPKG
@thi.ng/binary
Version:
latest (3.6.16)
3.6.16
3.6.15
3.6.14
3.6.13
3.6.11
3.6.10
3.6.9
3.6.8
3.6.7
3.6.6
3.6.5
3.6.4
3.6.3
3.6.2
3.6.1
3.6.0
3.5.0
3.4.68
3.4.67
3.4.66
3.4.65
3.4.64
3.4.60
3.4.59
3.4.58
3.4.57
3.4.56
3.4.55
3.4.54
3.4.53
3.4.52
3.4.51
3.4.50
3.4.49
3.4.48
3.4.47
3.4.46
3.4.45
3.4.44
3.4.43
3.4.42
3.4.41
3.4.40
3.4.39
3.4.38
3.4.37
3.4.36
3.4.35
3.4.34
3.4.33
3.4.32
3.4.31
3.4.30
3.4.29
3.4.28
3.4.27
3.4.26
3.4.25
3.4.24
3.4.23
3.4.22
3.4.21
3.4.20
3.4.19
3.4.18
3.4.17
3.4.16
3.4.15
3.4.14
3.4.13
3.4.12
3.4.11
3.4.10
3.4.9
3.4.8
3.4.7
3.4.6
3.4.5
3.4.4
3.4.3
3.4.2
3.4.1
3.4.0
3.3.40
3.3.39
3.3.38
3.3.37
3.3.36
3.3.35
3.3.34
3.3.33
3.3.32
3.3.31
3.3.30
3.3.29
3.3.28
3.3.27
3.3.26
3.3.25
3.3.24
3.3.23
3.3.22
3.3.21
3.3.20
3.3.19
3.3.18
3.3.17
3.3.16
3.3.15
3.3.14
3.3.13
3.3.12
3.3.11
3.3.10
3.3.9
3.3.8
3.3.7
3.3.6
3.3.5
3.3.4
3.3.3
3.3.2
3.3.1
3.3.0
3.2.3
3.2.2
3.2.1
3.2.0
3.1.3
3.1.2
3.1.1
3.1.0
3.0.8
3.0.7
3.0.6
3.0.4
3.0.3
3.0.2
3.0.1
3.0.0
2.2.11
2.2.10
2.2.9
2.2.8
2.2.7
2.2.6
2.2.5
2.2.4
2.2.3
2.2.2
2.2.1
2.2.0
2.1.0
2.0.21
2.0.20
2.0.19
2.0.18
2.0.17
2.0.16
2.0.15
2.0.14
2.0.13
2.0.12
2.0.11
2.0.10
2.0.9
2.0.8
2.0.7
2.0.6
2.0.5
2.0.4
2.0.3
2.0.2
2.0.1
2.0.0
1.3.2
1.3.1
1.3.0
1.2.1
1.2.0
1.1.1
1.1.0
1.0.8
1.0.7
1.0.6
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
0.1.2
0.1.1
0.1.0
0.0.1
100+ assorted binary / bitwise operations, conversions, utilities, lookup tables
thi.ng/binary
@thi.ng/binary
/
one-hot.js
8 lines
(7 loc)
•
164 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
import
{ clz32 }
from
"./count.js"
;
const
binaryOneHot
= (
x
) =>
1
<< x >>>
0
;
const
oneHotBinary
= (
x
) =>
31
-
clz32
(x);
export
{ binaryOneHot, oneHotBinary };