Answer the question
In order to leave comments, you need to log in
How to pack in 128 bit values?
You want to set the order of 32 elements with only 128 bits. "Almost" turns out.
Position 0 is one of 32 positions from 0 to 31, 5 bits are required.
The position of the 1st is one of the 31 remaining, 0..30, 5 bits.
...
15: 1 of 16, also 5 bits.
Total already 16 * 5 = 80
beat.
16: 1 of 15 positions, 4 bits already.
...
24: 1 of 8, 4 bits.
Total 80 + 4 * 8 = 112
bit used.
25: 1 of 7, 3 bits.
...
28: 1 of 4, 3 bits.
Total 112 + 3 * 4 = 124
29: 1 out of 3, 2 bits.
30: 1 of 2, 2 bits.
Total 124 + 4 = 128
bit.
There is not enough 1 bit to choose one of the two options at the 31st step.
Is it possible to somehow change the scheme and still put the variant of mixing 32 elements into 128 bits?
The inverse operation of obtaining unique integers 0..31 from a 128-bit array should not require quantum computing, of course.
Answer the question
In order to leave comments, you need to log in
Don't granulate what doesn't need to be granulated.
2^128 = 340282366920938463463374607431768211456
32! = 263130836933693530167218012160000000
25*5 = 125 < 128
или
5*3 < 16
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question