On May 11, 2006, at 3:24 AM, Ben van Klinken wrote:

Here is where the problem is, though: this
is not possible currently because we are using a VInt for the field
data length.

What we really need is the ability to add "leading zeroes" to a VInt.

I believe that this is possible if we change the definition of VInt so that the high bytes are written first, rather than the low bytes. The "BER compressed integer", used by Perl's pack() function, is defined this way. A proof-of-concept Perl script is below.

Marvin Humphrey
Rectangular Research
http://www.rectangular.com/

#-------------------------------------------------
#!/usr/bin/perl
use strict;
use warnings;

my $pad        = pack( 'C', 128 );    # "leading zero": 1000 0000
my $serialized = pack( 'wwawaaw', 127, 128, $pad, 129, $pad, $pad, 154 );

my @numbers = unpack( 'w*', $serialized );
print "@numbers\n";      # prints "127 128 129 154"

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to