public override int Encode(Asn1BerEncodeBuffer buffer, bool explicitTagging) { var len = buffer.EncodeIntValue(Value); if (explicitTagging) { len += buffer.EncodeTagAndLength(Tag, len); } return len; }
public override int Encode(Asn1BerEncodeBuffer buffer, bool explicitTagging) { var len = buffer.EncodeIntValue(Value); if (explicitTagging) { len += buffer.EncodeTagAndLength(Tag, len); } return(len); }
public override int Encode(Asn1BerEncodeBuffer buffer, bool explicitTagging) { var len = 0; if (double.IsNegativeInfinity(Value)) { len = buffer.EncodeIntValue(MinusInfinity); } else if (double.IsPositiveInfinity(Value)) { len = buffer.EncodeIntValue(PlusInfinity); } else if (Value != 0.0) { var num2 = BitConverter.DoubleToInt64Bits(Value); var num3 = ((num2 >> RealIso6093Mask) == 0L) ? 1 : -1; var num4 = ((int)((num2 >> 0x34) & 0x7ffL)) - 0x433; var w = (num4 == 0) ? ((num2 & 0xfffffffffffffL) << 1) : ((num2 & 0xfffffffffffffL) | 0x10000000000000L); if (w != 0L) { var bits = TrailingZerosCnt(w); w = Asn1Util.UrShift(w, bits); num4 += bits; } len += buffer.EncodeIntValue(w); var num7 = buffer.EncodeIntValue(num4); len += num7; var num8 = RealBinary; if (num3 == -1) { num8 |= PlusInfinity; } switch (num7) { case RealExplen2: break; case RealExplen3: num8 |= 1; break; case RealExplenLong: num8 |= 2; break; default: num8 |= 3; len += buffer.EncodeIntValue(num7); break; } buffer.Copy((byte)num8); len++; } if (explicitTagging) { len += buffer.EncodeTagAndLength(Tag, len); } return len; }