コード例 #1
0
        /// <summary>
        /// Read a float (4 bytes) from the stream
        /// </summary>
        public double ReadDouble()
        {
            double           value;
            FloatArrayBuffer bf_wfa;

            byte[] tmp;
            int    offset_double;

            offset_double = sizeof(double);

            tmp = new byte[offset_double];

            Array.Copy(this.data, (int)this.offset, tmp, 0, tmp.Length);

            bf_wfa = new FloatArrayBuffer(tmp);

            value = bf_wfa.Floats[0]; // implicit typecast combining 8 bytes into double

            this.offset += (ulong)offset_double;

            return(value);
        }
コード例 #2
0
        /// <summary>
        /// Read a float (4 bytes) from the stream
        /// </summary>
        public float ReadFloat()
        {
            float            value;
            FloatArrayBuffer bf_wfa;

            byte[] tmp;
            int    offset_float;

            offset_float = sizeof(float);

            tmp = new byte[offset_float];

            Array.Copy(this.data, (int)this.offset, tmp, 0, tmp.Length);

            bf_wfa = new FloatArrayBuffer(tmp);

            value = bf_wfa.Floats[0]; // implicit typecast combining 4 bytes into float

            this.offset += (ulong)offset_float;

            return(value);
        }