GSF.BinaryCodedDecimal.Encode C# (CSharp) Method

Encode() private method

private Encode ( byte value ) : byte
value byte
return byte
        public static byte Encode(byte value)
        {
            if (value > (byte)99)
                throw new ArgumentOutOfRangeException(nameof(value), "A binary-coded decimal has a maximum value of 99 for a single byte");

            byte high = (byte)((value / TenP1) & 0x0F);
            byte low = (byte)((value % TenP1) & 0x0F);

            return (byte)(low + (high << 4));
        }

Same methods

BinaryCodedDecimal::Encode ( uint value ) : uint
BinaryCodedDecimal::Encode ( ulong value ) : ulong
BinaryCodedDecimal::Encode ( ushort value ) : ushort
BinaryCodedDecimal