Created
April 27, 2018 19:13
-
-
Save DevJohnC/7612e6cb944a21977e128d4003b8be6b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
public static class BigEndianBitConverter | |
{ | |
public static UInt16 ToUInt16(byte[] value, int startIndex) | |
{ | |
return (ushort)( | |
value[startIndex + 1] | | |
value[startIndex] << 8 | |
); | |
} | |
public static UInt32 ToUInt32(byte[] value, int startIndex) | |
{ | |
return (uint)( | |
value[startIndex + 3] | | |
value[startIndex + 2] << 8 | | |
value[startIndex + 1] << 16 | | |
value[startIndex] << 24 | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment