-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e032381
commit 892250e
Showing
2 changed files
with
13 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
using System.Runtime.CompilerServices; | ||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace TACTLib.Helpers | ||
{ | ||
[InlineArray(3)] | ||
[StructLayout(LayoutKind.Sequential)] | ||
public struct UInt24BE | ||
{ | ||
private byte m_first; | ||
private byte m_a; | ||
private byte m_b; | ||
private byte m_c; | ||
|
||
public readonly int ToInt() | ||
{ | ||
return this[2] | (this[1] << 8) | (this[0] << 16); | ||
if (BitConverter.IsLittleEndian) | ||
{ | ||
return m_c | (m_b << 8) | (m_a << 16); | ||
} | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |