/// <summary> /// Encode single OID value. /// </summary> /// <param name="bt">output stream.</param> /// <param name="v">source value.</param> protected void EncodeValue(Stream bt, ulong v) { for (int i = (Asn1Util.BitPrecision(v) - 1) / 7; i > 0; i--) { bt.WriteByte((byte)(0x80 | ((v >> (i * 7)) & 0x7f))); } bt.WriteByte((byte)(v & 0x7f)); }
protected void EncodeValue(Stream bt, ulong v) { for (int index = (Asn1Util.BitPrecision(v) - 1) / 7; index > 0; --index) { bt.WriteByte((byte)(128UL | v >> index * 7 & (ulong)sbyte.MaxValue)); } bt.WriteByte((byte)(v & (ulong)sbyte.MaxValue)); }