VarINTs & Varbits

Blitz3D Forums/Blitz3D Programming/VarINTs & Varbits

virtlands(Posted 2013) [#1]
The updated version of the Varbits.BB code is shown below:


Yasha(Posted 2013) [#2]
Ha, this is some cool stuff. Nice work!


Axel Wheeler(Posted 2013) [#3]
Nice job!


virtlands(Posted 2013) [#4]
[updated]


virtlands(Posted 2013) [#5]
Here's Version 2 of my VarBits program.

This is a vast improvement over the old one, and includes several new functions.

The code also works with negative numbers too, but the screenshots don't yet give negative examples.
It's true, 32-bit negative numbers can also be represented by Varbits.

I'll be back later to explain that detail. ------

You are free to edit and use these functions as you wish, and reorganize it
into your own program.



I tested it for hours and hours... If you discover any bugs, let me know.

I'll be back later on to explain Varbits in more detail later; I'm out of time for today. ;)


virtlands(Posted 2013) [#6]
I had some time to make this diagram to help explain this stuff.

The function VarBits(n, b) will generative results
for both positive and negative numbers (n<0 OR n>0),
( b=bits length, and n=the number to convert )

[ This screenshot shows a few negative values: ]


This next screenshot demonstrates a few positive values,
where bits_length = 3 and base=4 :


Most of the time, varbits (VarNibbles, VarInts, etc) won't be
used for much, since obviously the compression result isn't
that great, so this is just a study in concept.