Exemple #1
0
        /**
         * double型(8バイト書き込み)
         * @param n
         * @throws IOException
         */
        public void WriteDouble(double f)
        {
            Bit64Change ch = new Bit64Change();
            long        n  = ch.DoubleToRawLongBits(f);

            this.WriteLong(n);
        }
        /// <summary>
        /// double型(8バイト読み込み)
        /// </summary>
        /// <returns>double型の値を返す</returns>
        public unsafe double ReadDouble()
        {
            if (m_isBigEndian)
            {
                double tmp; ReadByte(&tmp, 8); return(tmp);
            }
            Bit64Change ch = new Bit64Change();

            return(ch.LongBitsToDouble(ReadLong()));
        }
Exemple #3
0
        /// <summary>
        /// long型(8バイト書き込み)
        /// </summary>
        /// <param name="n"></param>
        public void WriteLong(long n)
        {
            Bit64Change ch = new Bit64Change();
            ulong       u  = ch.LongBitsToULong(n);

            m_fo.WriteByte((byte)(u & 0x00000000000000FF));
            m_fo.WriteByte((byte)((u & 0x000000000000FF00) >> 8));
            m_fo.WriteByte((byte)((u & 0x0000000000FF0000) >> 16));
            m_fo.WriteByte((byte)((u & 0x00000000FF000000) >> 24));
            m_fo.WriteByte((byte)((u & 0x000000FF00000000) >> 32));
            m_fo.WriteByte((byte)((u & 0x0000FF0000000000) >> 40));
            m_fo.WriteByte((byte)((u & 0x00FF000000000000) >> 48));
            m_fo.WriteByte((byte)((u & 0xFF00000000000000) >> 56));
        }
        /// <summary>
        /// long型(8バイト書き込み)
        /// </summary>
        /// <param name="n">long型の整数</param>
        public unsafe void WriteLong(long n)
        {
            if (m_isBigEndian)
            {
                WriteByte(&n, 8); return;
            }
            Bit64Change ch = new Bit64Change();
            ulong       u  = ch.LongBitsToULong(n);

            WriteByte((byte)(u & 0x00000000000000FF));
            WriteByte((byte)((u & 0x000000000000FF00) >> 8));
            WriteByte((byte)((u & 0x0000000000FF0000) >> 16));
            WriteByte((byte)((u & 0x00000000FF000000) >> 24));
            WriteByte((byte)((u & 0x000000FF00000000) >> 32));
            WriteByte((byte)((u & 0x0000FF0000000000) >> 40));
            WriteByte((byte)((u & 0x00FF000000000000) >> 48));
            WriteByte((byte)((u & 0xFF00000000000000) >> 56));
        }
Exemple #5
0
        /**
         * double型(8バイト読み込み)
         * @return doubleの値を返す
         * @throws IOException
         */
        public double ReadDouble()
        {
            Bit64Change ch = new Bit64Change();

            return(ch.LongBitsToDouble(ReadLong()));
        }