mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-01-11 19:44:55 +00:00
fix[BigEndianBitConverter]: Fix ToLong and ToUlong overflow errors
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user