Guest_imported
New member
- Jan 1, 1970
- 0
Please help me convert these two C routines to Visual Basic!
void WriteVarLen(register unsigned long value)
{
register unsigned long buffer;
buffer = value & 0x7F;
while ( (value >>= 7) )
{
buffer <<= 8;
buffer |= ((value & 0x7F) | 0x80);
}
while (TRUE)
{
putc(buffer,outfile);
if (buffer & 0x80)
buffer >>= 8;
else
break;
}
}
unsigned long ReadVarLen()
{
register unsigned long value;
register unsigned char c;
if ( (value = getc(infile)) & 0x80 )
{
value &= 0x7F;
do
{
value = (value <<7) + ((c = getc(infile)) & 0x7F);
} while (c & 0x80);
}
}
return(value);
}
void WriteVarLen(register unsigned long value)
{
register unsigned long buffer;
buffer = value & 0x7F;
while ( (value >>= 7) )
{
buffer <<= 8;
buffer |= ((value & 0x7F) | 0x80);
}
while (TRUE)
{
putc(buffer,outfile);
if (buffer & 0x80)
buffer >>= 8;
else
break;
}
}
unsigned long ReadVarLen()
{
register unsigned long value;
register unsigned char c;
if ( (value = getc(infile)) & 0x80 )
{
value &= 0x7F;
do
{
value = (value <<7) + ((c = getc(infile)) & 0x7F);
} while (c & 0x80);
}
}
return(value);
}