fix[BigEndianBitConverter]: Fix ToLong and ToUlong overflow errors

This commit is contained in:
Drew Tingen
2023-06-18 09:51:22 -04:00
parent e84bc721ee
commit 138a6f3470

View File

@@ -78,9 +78,9 @@ namespace ICD.Common.Utils
if (startIndex > value.Length - bytes) if (startIndex > value.Length - bytes)
throw new ArgumentException("Array plus start index too small"); throw new ArgumentException("Array plus start index too small");
int result = 0; long result = 0;
for (int i = 0; i < bytes; i++) for (int i = 0; i < bytes; i++)
result |= value[i + startIndex] << GetBitShift(i, bytes); result |= (long)(value[i + startIndex]) << GetBitShift(i, bytes);
return result; return result;
} }