mirror of
https://github.com/S7NetPlus/s7netplus.git
synced 2026-02-17 22:38:27 +08:00
Fix byte order when serializing short[] / Int16[]
Values should be written as big-endian, unfortunately the ordering for short values in an array was little-endian.
This commit is contained in:
@@ -45,8 +45,8 @@ namespace S7.Net.Types
|
||||
|
||||
for(int i=0; i< value.Length; i++)
|
||||
{
|
||||
bytes[bytesPos++] = (byte)((int)value[i] & 0xFF);
|
||||
bytes[bytesPos++] = (byte)(((int)value[i] >> 8) & 0xFF);
|
||||
bytes[bytesPos++] = (byte)((value[i] >> 8) & 0xFF);
|
||||
bytes[bytesPos++] = (byte) (value[i] & 0xFF);
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user