public static void WriteUInt32Variant(UInt32 value, FPGA.SyncStream <byte> output) { // reserve 10 bytes byte[] buff = new byte[10]; int count = 0; do { buff[count] = (byte)((value & 0x7F) | 0x80); count++; } while ((value >>= 7) != 0); byte tmp; tmp = buff[count - 1]; buff[count - 1] = (byte)(tmp & 0x7F); for (int i = 0; i < count; i++) { tmp = buff[i]; output.Write(tmp); } }
public static void WriteHeaderCore(int fieldNumber, QWireType wireType, FPGA.SyncStream <byte> output) { uint header = (((uint)fieldNumber) << 3) | (((uint)wireType) & 7); WriteUInt32Variant(header, output); }