Unknown Code

new topic     » topic index » view thread      » older message » newer message

HI,

I'm writting to ask if someone will
translate these few lines of C code
to Euphoria. I'm studying MIDI
and understand everything except
how to convert "variable length
quantities". These are needed for
storing delta-time. I can't figure out
which bits are to be discarded and
don't know if << 7 shift equals an 8-bit
shift or not. ..thanks   timmy :)


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);
}

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu