mirror of
https://github.com/fbarresi/Sharp7.git
synced 2026-02-04 08:42:51 +00:00
@@ -1,6 +1,12 @@
|
||||
# Change Log
|
||||
All notable changed to this project will be documented in this file.
|
||||
|
||||
## [1.1.80] - 18.05.2022
|
||||
### Added
|
||||
### Changed
|
||||
### Fixed
|
||||
- Fixed casting in GetIntAt [#29](https://github.com/fbarresi/Sharp7/issues/29)
|
||||
|
||||
## [1.1.79] - 09.02.2021
|
||||
### Added
|
||||
- Constant for no errors `S7Consts.ResultOK`
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace Sharp7.Tests
|
||||
|
||||
[Theory]
|
||||
[InlineData(new byte[] { 1, 1, 0, 0 }, 0, 257)]
|
||||
public void TestGetIntAt(byte[] buffer, int pos, int expected) { S7.GetIntAt(buffer, pos).ShouldBe(expected); }
|
||||
public void TestGetIntAt(byte[] buffer, int pos, short expected) { S7.GetIntAt(buffer, pos).ShouldBe(expected); }
|
||||
|
||||
[Theory]
|
||||
[InlineData(new byte[] { 0, 0, 0, 0 }, 0, 1, new byte[] { 0, 1, 0, 0 })]
|
||||
|
||||
@@ -103,9 +103,9 @@ namespace Sharp7
|
||||
|
||||
#region Get/Set 16 bit signed value (S7 int) -32768..32767
|
||||
|
||||
public static int GetIntAt(this byte[] buffer, int pos)
|
||||
public static short GetIntAt(this byte[] buffer, int pos)
|
||||
{
|
||||
return (buffer[pos] << 8) | buffer[pos + 1];
|
||||
return (short)((buffer[pos] << 8) | buffer[pos + 1]);
|
||||
}
|
||||
|
||||
public static void SetIntAt(this byte[] buffer, int pos, Int16 value)
|
||||
|
||||
Reference in New Issue
Block a user