diff options
author | Jerome Fisher | 2004-11-14 07:54:43 +0000 |
---|---|---|
committer | Jerome Fisher | 2004-11-14 07:54:43 +0000 |
commit | 0ed79dfad78aeb61961c7f865e8cc7f45840fe28 (patch) | |
tree | 3e20d5fe0d7b15fe347e650b106ca74211d15439 /backends/midi/mt32 | |
parent | a158e884a0abc347dfabbd140f21d52fc137cd79 (diff) | |
download | scummvm-rg350-0ed79dfad78aeb61961c7f865e8cc7f45840fe28.tar.gz scummvm-rg350-0ed79dfad78aeb61961c7f865e8cc7f45840fe28.tar.bz2 scummvm-rg350-0ed79dfad78aeb61961c7f865e8cc7f45840fe28.zip |
- Prettied up, fixed sign-extension bug.
svn-id: r15803
Diffstat (limited to 'backends/midi/mt32')
-rw-r--r-- | backends/midi/mt32/mt32_file.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/backends/midi/mt32/mt32_file.cpp b/backends/midi/mt32/mt32_file.cpp index 1537b734e7..8cf4e14a7d 100644 --- a/backends/midi/mt32/mt32_file.cpp +++ b/backends/midi/mt32/mt32_file.cpp @@ -57,7 +57,7 @@ namespace MT32Emu { } bool File::readBit16u(Bit16u *in) { - char b[2]; + Bit8u b[2]; if (read(&b[0], 2) != 2) return false; *in = ((b[0] << 8) | b[1]); @@ -65,7 +65,7 @@ namespace MT32Emu { } bool File::readBit32u(Bit32u *in) { - char b[4]; + Bit8u b[4]; if (read(&b[0], 4) != 4) return false; *in = ((b[0] << 24) | (b[1] << 16) | (b[2] << 8) | b[3]); @@ -81,26 +81,26 @@ namespace MT32Emu { } bool File::writeBit16u(Bit16u out) { - if (!writeBit8u((Bit8u)((out >> 8) & 0xFF))) { + if (!writeBit8u((Bit8u)((out & 0xFF00) >> 8))) { return false; } - if (!writeBit8u((Bit8u)(out & 0xFF))) { + if (!writeBit8u((Bit8u)(out & 0x00FF))) { return false; } return true; } bool File::writeBit32u(Bit32u out) { - if (!writeBit8u((Bit8u)((out >> 24) & 0xFF))) { + if (!writeBit8u((Bit8u)((out & 0xFF000000) >> 24))) { return false; } - if (!writeBit8u((Bit8u)((out >> 16) & 0xFF))) { + if (!writeBit8u((Bit8u)((out & 0x00FF0000) >> 16))) { return false; } - if (!writeBit8u((Bit8u)((out >> 8) & 0xFF))) { + if (!writeBit8u((Bit8u)((out & 0x0000FF00) >> 8))) { return false; } - if (!writeBit8u((Bit8u)(out & 0xFF))) { + if (!writeBit8u((Bit8u)(out & 0x000000FF))) { return false; } return true; |