public static void WriteVarint64(ByteStream byteStream, long value) { const int B = 128; int pos = 0; ulong uVal = IntTool.EncodeZigZag64(value); byte[] buf = new byte[10]; buf[pos++] = (byte)PDBType.BigInt; while (uVal >= B) { buf[pos++] = (byte)((uVal & (B - 1)) | B); uVal >>= 7; } buf[pos++] = (byte)uVal; byteStream.Write(buf, 0, pos); }