pub fn vli_decode(&mut self, bits: i32) -> i64 {
        let mut b = self.byte();
        let sign = b & 0x40;

        // first group of 6 bits
        let mut value = (b & 0x3f) as i64;
        let mut s = 6;

        // while continuation bit is set
        while (b & 0x80) != 0 {
            if s >= bits {
                panic("integer representation too long");
            }

            // next group of 7 bits
            b = self.byte();
            value |= ((b & 0x7f) as i64) << s;
            s += 7;
        }

        if sign == 0 {
            // positive, sign bits are already zero
            return value;
        }

        // negative, extend sign bits
        value | (-1_i64 << s)
    }
// vli (variable length integer) decoder
vli (variable length integer) decoder
vli ( variable length integer ) decoder
pub fn vli_decode(&mut self, bits: i32) -> i64 {
        let mut b = self.byte();
        let sign = b & 0x40;
        // first group of 6 bits
        let mut value = (b & 0x3f) as i64;
        let mut s = 6;
        // while continuation bit is set
        while (b & 0x80) != 0 {
            if s >= bits {
                panic("integer representation too long");
            }
            // next group of 7 bits
            b = self.byte();
            value |= ((b & 0x7f) as i64) << s;
            s += 7;
        }
        if sign == 0 {
            // positive, sign bits are already zero
            return value;
        }
        // negative, extend sign bits
        value | (-1_i64 << s)
    }
pub fn vli_decode ( & mut self , bits : i32 ) -> i64 { let mut b = self . byte ( ) ; let sign = b & 0x40 ; // first group of 6 bits let mut value = ( b & 0x3f ) as i64 ; let mut s = 6 ; // while continuation bit is set while ( b & 0x80 ) != 0 { if s >= bits { panic ( " " ) ; } // next group of 7 bits b = self . byte ( ) ; value |= ( ( b & 0x7f ) as i64 ) << s ; s += 7 ; } if sign == 0 { // positive, sign bits are already zero return value ; } // negative, extend sign bits value | ( - 1_i64 << s ) }
vli (variable length integer) decoder
vli ( variable length integer ) decoder
&mut self
bits
i32