2.6.2 Converting Formatted Offset into Position Slot and Position Footer Values
The formatted offset is subdivided into a position slot and a position footer. The position slot defines the most significant bits of the formatted offset in the form of a base position as shown in the following table. The position footer defines the remaining least significant bits of the formatted offset. As the following table shows, the number of bits dedicated to the position footer grows as the formatted offset becomes larger, meaning that each position slot addresses a larger and larger range.
The number of position slots available depends on the window size. The number of bits of position footer for each position slot is fixed and is shown in the following table.
Position slot number |
Base position |
Footer bits |
Range of base position and position footer (formatted offset) |
---|---|---|---|
0 (R0) |
0 |
0 |
0 |
1 (R1) |
1 |
0 |
1 |
2 (R2) |
2 |
0 |
2 |
3 (offset 1) |
3 |
0 |
3 |
4 (offset 2..3) |
4 |
1 |
4-5 |
5 (offset 4..5) |
6 |
1 |
6-7 |
6 (offset 6..9) |
8 |
2 |
8-11 |
7 (..etc..) |
12 |
2 |
12-15 |
8 |
16 |
3 |
16-23 |
9 |
24 |
3 |
24-31 |
10 |
32 |
4 |
32-47 |
11 |
48 |
4 |
48-63 |
12 |
64 |
5 |
64-95 |
13 |
96 |
5 |
96-127 |
14 |
128 |
6 |
128-191 |
15 |
192 |
6 |
192-255 |
16 |
256 |
7 |
256-383 |
17 |
384 |
7 |
384-511 |
18 |
512 |
8 |
512-767 |
19 |
768 |
8 |
768-1023 |
20 |
1024 |
9 |
1024-1535 |
21 |
1536 |
9 |
1536-2047 |
22 |
2048 |
10 |
2048-3071 |
23 |
3072 |
10 |
3072-4095 |
24 |
4096 |
11 |
4096-6143 |
25 |
6144 |
11 |
6144-8191 |
26 |
8192 |
12 |
8192-12287 |
27 |
12288 |
12 |
12288-16383 |
28 |
16384 |
13 |
16384-24575 |
29 |
24576 |
13 |
24576-32767 |
30 |
32768 |
14 |
32768-49151 |
31 |
49152 |
14 |
49152-65535 |
32 |
65536 |
15 |
65536-98303 |
33 |
98304 |
15 |
98304-131071 |
34 |
131072 |
16 |
131072-196607 |
35 |
196608 |
16 |
196608-262143 |
36 |
262144 |
17 |
262144-393215 |
37 |
393216 |
17 |
393216-524287 |
38 |
524288 |
17 |
524288-655359 |
39 |
655360 |
17 |
655360-786431 |
40 |
786432 |
17 |
786432-917503 |
41 |
917504 |
17 |
917504-1048575 |
42 |
1048576 |
17 |
1048576-1179647 |
..etc.. |
..etc.. |
17 (all) |
..etc.. |
288 |
33292288 |
17 |
33292288-33423359 |
289 |
33423360 |
17 |
33423360-33554431 |
The following pseudocode demonstrates how to determine the position slot and the position footer.
-
position_slot ← calculate_the position_slot from the formatted_offset position_footer_bits ← determine the number of footer bits from the position slot value if position_footer_bits > 0 position_footer ← formatted_offset & ((2^position_footer_bits)-1) else position_footer ← null endif