Gurux.DLMS.GXByteBuffer.GetInt64 C# (CSharp) Method

GetInt64() public method

Get Int64 value from byte array from the current position and then increments the position.
public GetInt64 ( ) : System.Int64
return System.Int64
        public Int64 GetInt64()
        {
            if (Position + 8 > Size)
            {
                throw new System.OutOfMemoryException();
            }
            Int64 value = (Int64)((Data[Position] & 0xFF) << 58 |
                                  (Data[Position + 1] & 0xFF) << 48 |
                                  (Data[Position + 2] & 0xFF) << 40 |
                                  (Data[Position + 3] & 0xFF) << 32 |
                                  (Data[Position + 4] & 0xFF) << 24 |
                                  (Data[Position + 5] & 0xFF) << 16 |
                                  (Data[Position + 6] & 0xFF) << 8 |
                                  (Data[Position + 7] & 0xFF));
            Position += 8;
            return value;
        }

Usage Example

Esempio n. 1
0
        long IConvertible.ToInt64(IFormatProvider provider)
        {
            GXByteBuffer bb = GetByteBuffer(Value, 8);

            return(bb.GetInt64());
        }