I need to take pairs of bytes in, and output shorts, and take shorts in and output pairs of bytes. Here are the functions i\'ve devised for such a purpose:
s
Shorter version (also shifting 8 bits instead of 4):
static short ToShort(short byte1, short byte2) { return (byte2 << 8) + byte1; } static void FromShort(short number, out byte byte1, out byte byte2) { byte2 = (byte)(number >> 8); byte1 = (byte)(number & 255); }