/// <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)); }