SerraAvenger
Cuz I can
- Reaction score
- 234
NOTE:
I think I read some time ago that your system doesn't use multiple integers, instead it tries to save as much info into one integer as possible in order to save space...
Just in case you really map n-dimensional arrays into integers (I did that), this might be intersting for you...
length = Log_base( integer + 1)
adding codes:
length = length1 + length2 = Log_base( integer1 + 1 ) + Log_base( integer2 + 1 ) = Log_base( integer1 * integer2 + integer1 + integer 2 + 1 )
mapping n-dimensional arrays:
length = Log_base( integer1_max * integer2 + integer1 +1 )
since integer1_max >= integer1,
integer1_max * integer2 >= ( integer1 + 1 ) * integer2 (in any reasonable case it's > )
hence it is actually stupid to compress everything into one integer, lots of space will be lost. In fact it should be clever to encode every number on its own and use + and - as a seperator. That way you can save _any_ JASS integer in upto x digits (with a reasonable base of 36, that would be log(2^31)/log(36)=31*log(2)/log(36)=5.99=> 6 ), which is absolutely fine. The smaller the integer, the shorter the code... That is the most clever "compression" I can actually think of.
(example code, in base 10)
+304-41423-425+3566
->
+304
-41423
-425
+3566
In base 36 the code would ofc get much shorter.
If you find any flaws, plz tell me....
I think I read some time ago that your system doesn't use multiple integers, instead it tries to save as much info into one integer as possible in order to save space...
Just in case you really map n-dimensional arrays into integers (I did that), this might be intersting for you...
length = Log_base( integer + 1)
adding codes:
length = length1 + length2 = Log_base( integer1 + 1 ) + Log_base( integer2 + 1 ) = Log_base( integer1 * integer2 + integer1 + integer 2 + 1 )
mapping n-dimensional arrays:
length = Log_base( integer1_max * integer2 + integer1 +1 )
since integer1_max >= integer1,
integer1_max * integer2 >= ( integer1 + 1 ) * integer2 (in any reasonable case it's > )
hence it is actually stupid to compress everything into one integer, lots of space will be lost. In fact it should be clever to encode every number on its own and use + and - as a seperator. That way you can save _any_ JASS integer in upto x digits (with a reasonable base of 36, that would be log(2^31)/log(36)=31*log(2)/log(36)=5.99=> 6 ), which is absolutely fine. The smaller the integer, the shorter the code... That is the most clever "compression" I can actually think of.
(example code, in base 10)
+304-41423-425+3566
->
+304
-41423
-425
+3566
In base 36 the code would ofc get much shorter.
If you find any flaws, plz tell me....