2 [momiji music component library]
3 ---------------------------------------------------------------------
4 Momiji.Sequencer.Midi.Smf.h
5 stream component of standard midi file.
6 ---------------------------------------------------------------------
7 Copyright (C) 2011 tyiki badwell {miria@users.sourceforge.jp}.
9 This program is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/gpl-3.0.html>.
21 ---------------------------------------------------------------------
27 using namespace System::Runtime;
42 <param name="data">ビッグエンディアンの2バイトデータ</param>
43 <returns>システムがリトルエンディアンであれば、変換して返す。</returns>
45 static System::UInt16 ToHostOrder(System::UInt16 data)
47 if (System::BitConverter::IsLittleEndian)
49 return safe_cast<System::UInt16>(
50 ((data >> 8) & 0x00FF) |
51 ((data << 8) & 0xFF00)
61 <param name="data">ビッグエンディアンの4バイトデータ</param>
62 <returns>システムがリトルエンディアンであれば、変換して返す。</returns>
64 static System::UInt32 ToHostOrder(System::UInt32 data)
66 if (System::BitConverter::IsLittleEndian)
69 ((data >> 24) & 0x000000FFL) |
70 ((data >> 8 ) & 0x0000FF00L) |
71 ((data << 8 ) & 0x00FF0000L) |
72 ((data << 24) & 0xFF000000L)