2 583
edições
Linha 25: | Linha 25: | ||
natcod.vbit_to_baseh(bitstring,16,true) as b16h, | natcod.vbit_to_baseh(bitstring,16,true) as b16h, | ||
natcod.vBit_to_hCount16c48(bitstring,1::bigint) as hcount1, | natcod.vBit_to_hCount16c48(bitstring,1::bigint) as hcount1, | ||
natcod.vBit_to_hCount16c48(bitstring, | natcod.vBit_to_hCount16c48(bitstring,281474976710655::bigint) as hcount_max | ||
FROM natcod.generate_vbit_series(11) t(bitstring) | FROM natcod.generate_vbit_series(11) t(bitstring) -- or 3 | ||
; | ; | ||
CREATE VIEW wiki_print3_hcount_explode AS | |||
SELECT bitstring, len, | |||
hcount as hcount_dec, | |||
'0 '||substring(hcount::bit(64),2,11)::text ||' '||len::bit(4)::text||' '||((hcount<<16)>>16)::bit(48)::text hcount_bin | |||
FROM ( | |||
SELECT *,length(bitstring) as len, natcod.vBit_to_hCount16c48(bitstring,123::bigint) as hcount | |||
FROM wiki_print2_hcount | |||
) t; | |||
</syntaxhighlight> | </syntaxhighlight> | ||
<pre> | <pre> | ||
wiki_print1_hbig: | wiki_print1_hbig: | ||
Linha 49: | Linha 58: | ||
wiki_print2_hcount: | wiki_print2_hcount: | ||
count | bitstring | b16h | hcount1 | | count | bitstring | b16h | hcount1 | hcount_max | ||
------+-------------+------+---------------------+--------------------- | ------+-------------+------+---------------------+--------------------- | ||
1 | 0 | G | 281474976710657 | | 1 | 0 | G | 281474976710657 | 562949953421311 | ||
2 | 00 | H | 562949953421313 | | 2 | 00 | H | 562949953421313 | 844424930131967 | ||
3 | 000 | J | 844424930131969 | | 3 | 000 | J | 844424930131969 | 1125899906842623 | ||
4 | 0000 | 0 | 1125899906842625 | | 4 | 0000 | 0 | 1125899906842625 | 1407374883553279 | ||
5 | 00000 | 0G | 1407374883553281 | | 5 | 00000 | 0G | 1407374883553281 | 1688849860263935 | ||
6 | 000000 | 0H | 1688849860263937 | | 6 | 000000 | 0H | 1688849860263937 | 1970324836974591 | ||
7 | 0000000 | 0J | 1970324836974593 | | 7 | 0000000 | 0J | 1970324836974593 | 2251799813685247 | ||
8 | 00000000 | 00 | 2251799813685249 | | 8 | 00000000 | 00 | 2251799813685249 | 2533274790395903 | ||
9 | 000000000 | 00G | 2533274790395905 | | 9 | 000000000 | 00G | 2533274790395905 | 2814749767106559 | ||
10 | 0000000000 | 00H | 2814749767106561 | | 10 | 0000000000 | 00H | 2814749767106561 | 3096224743817215 | ||
11 | 00000000000 | 00J | 3096224743817217 | | 11 | 00000000000 | 00J | 3096224743817217 | 3377699720527871 | ||
12 | 00000000001 | 00K | 7599824371187713 | | 12 | 00000000001 | 00K | 7599824371187713 | 7881299347898367 | ||
13 | 0000000001 | 00M | 11821949021847553 | | 13 | 0000000001 | 00M | 11821949021847553 | 12103423998558207 | ||
... | ... | ||
wiki_print3_hcount_explode: | |||
bitstring | len | hcount_dec | hcount_bin | |||
----------+-----+---------------------+--------------------------------------------------------------------- | |||
0 | 1 | 281474976710779 | 0 00000000000 0001 000000000000000000000000000000000000000001111011 | |||
00 | 2 | 562949953421435 | 0 00000000000 0010 000000000000000000000000000000000000000001111011 | |||
000 | 3 | 844424930132091 | 0 00000000000 0011 000000000000000000000000000000000000000001111011 | |||
001 | 3 | 1153765929536979067 | 0 00100000000 0011 000000000000000000000000000000000000000001111011 | |||
... | |||
</pre> | </pre> | ||
=== Exemplo de comprimento 11 === | === Exemplo de comprimento 11 === |
edições