4-bit find first set (priority encoder). Returns 1-indexed position of the least significant set bit.
Function
ffs4(a3, a2, a1, a0) = position of first (least significant) 1 bit, 0 if no bits set
Truth Table (selected rows)
Input
First bit
Output (y2,y1,y0)
0000
none
000 (0)
0001
bit 0
001 (1)
0010
bit 1
010 (2)
0011
bit 0
001 (1)
0100
bit 2
011 (3)
1000
bit 3
100 (4)
1010
bit 1
010 (2)
Architecture
Layer 1: Priority detection
has0 = a0 (bit 0 is set)
has1_first = a1 AND NOT(a0)
has2_first = a2 AND NOT(a1) AND NOT(a0)
has3_first = a3 AND NOT(a2) AND NOT(a1) AND NOT(a0)
Layer 2: Binary encoding
y0 = has0 OR has2_first (ffs is 1 or 3)
y1 = has1_first OR has2_first (ffs is 2 or 3)
y2 = has3_first (ffs is 4)
Parameters
Inputs
4
Outputs
3
Neurons
7
Layers
2
Parameters
35
Magnitude
22
Usage
from safetensors.torch import load_file
# See model.py for full implementation# ffs4(1, 0, 1, 0) = [0, 1, 0] = 2 (bit 1 is first set)# ffs4(0, 0, 0, 1) = [0, 0, 1] = 1 (bit 0 is first set)
License
MIT
Runs of phanerozoic threshold-ffs4 on huggingface.co
15
Total runs
0
24-hour runs
2
3-day runs
4
7-day runs
6
30-day runs
More Information About threshold-ffs4 huggingface.co Model
threshold-ffs4 huggingface.co is an AI model on huggingface.co that provides threshold-ffs4's model effect (), which can be used instantly with this phanerozoic threshold-ffs4 model. huggingface.co supports a free trial of the threshold-ffs4 model, and also provides paid use of the threshold-ffs4. Support call threshold-ffs4 model through api, including Node.js, Python, http.
threshold-ffs4 huggingface.co is an online trial and call api platform, which integrates threshold-ffs4's modeling effects, including api services, and provides a free online trial of threshold-ffs4, you can try threshold-ffs4 online for free by clicking the link below.
phanerozoic threshold-ffs4 online free url in huggingface.co:
threshold-ffs4 is an open source model from GitHub that offers a free installation service, and any user can find threshold-ffs4 on GitHub to install. At the same time, huggingface.co provides the effect of threshold-ffs4 install, users can directly use threshold-ffs4 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.