Skip to content

Instantly share code, notes, and snippets.

@MartinZikmund
Created January 6, 2019 08:00
Show Gist options
  • Save MartinZikmund/d550f1c64cdeb3df8b23166b1160b5d8 to your computer and use it in GitHub Desktop.
Save MartinZikmund/d550f1c64cdeb3df8b23166b1160b5d8 to your computer and use it in GitHub Desktop.
Correct approach for converting two little-endian bytes to ushort
var result = (ushort)((data[position + 1] << 8) + data[position]); //note the additional parentheses
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment