From 138a6f3470b101f119cef95f1c822444da5d36eb Mon Sep 17 00:00:00 2001 From: Drew Tingen Date: Sun, 18 Jun 2023 09:51:22 -0400 Subject: [PATCH] fix[BigEndianBitConverter]: Fix ToLong and ToUlong overflow errors --- ICD.Common.Utils/BigEndianBitConverter.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ICD.Common.Utils/BigEndianBitConverter.cs b/ICD.Common.Utils/BigEndianBitConverter.cs index f5a0e0c..67d79c4 100644 --- a/ICD.Common.Utils/BigEndianBitConverter.cs +++ b/ICD.Common.Utils/BigEndianBitConverter.cs @@ -78,9 +78,9 @@ namespace ICD.Common.Utils if (startIndex > value.Length - bytes) throw new ArgumentException("Array plus start index too small"); - int result = 0; + long result = 0; for (int i = 0; i < bytes; i++) - result |= value[i + startIndex] << GetBitShift(i, bytes); + result |= (long)(value[i + startIndex]) << GetBitShift(i, bytes); return result; }