Пример #1
0
        private decimal ReadOverlappedDecimal()
        {
            var proxy = new DecimalProxy
            {
                lo    = (int)ReadOverlapped(sizeof(int)),
                mid   = (int)ReadOverlapped(sizeof(int)),
                hi    = (int)ReadOverlapped(sizeof(int)),
                flags = (int)ReadOverlapped(sizeof(int))
            };

            return(*(decimal *)&proxy);
        }
Пример #2
0
        public decimal ReadDecimal()
        {
            if (!CurrentBufferHasEnoughBytes(sizeof(decimal)))
            {
                return(ReadOverlappedDecimal());
            }

            var proxy = new DecimalProxy();

            proxy.lo    = *(int *)_position;
            _position  += sizeof(int);
            proxy.mid   = *(int *)_position;
            _position  += sizeof(int);
            proxy.hi    = *(int *)_position;
            _position  += sizeof(int);
            proxy.flags = *(int *)_position;
            _position  += sizeof(int);

            return(*(decimal *)&proxy);
        }