AlphaTab.Audio.Generator.MidiFileHandler.WriteVarInt C# (CSharp) Method

WriteVarInt() private static method

private static WriteVarInt ( ByteBuffer data, int v ) : void
data AlphaTab.IO.ByteBuffer
v int
return void
        private static void WriteVarInt(ByteBuffer data, int v)
        {
            var n = 0;
            var array = new byte[4];
            do
            {
                array[n++] = (byte)((v & 0x7F) & 0xFF);
                v >>= 7;
            } while (v > 0);

            while (n > 0)
            {
                n--;
                if (n > 0)
                    data.WriteByte((byte)((array[n] | 0x80) & 0xFF));
                else
                    data.WriteByte(array[n]);
            }
        }