private sum ( int idxStart, int byteCount, byte arrayToCount ) : long | ||
idxStart | int | start index |
byteCount | int | number of bytes |
arrayToCount | byte | byte array |
Результат | long |
private long sum(int idxStart, int byteCount, byte[] arrayToCount)
{
//check erros
if (idxStart < 0)
return long.MaxValue;
if ((idxStart + byteCount) > arrayToCount.Length)
return long.MaxValue;
//do the sum
long retval = 0;
for (int i = idxStart; i < (idxStart + byteCount); i++)
{
retval += arrayToCount[i];
}
return retval;
}