Use 1 << exp instead of Math.Pow(2, exp)

This commit is contained in:
Frederik Carlier
2019-06-12 16:57:50 +02:00
parent bdbce8d547
commit 40dbb464a3

View File

@@ -268,13 +268,13 @@ namespace Claunia.PropertyList
case 0x1:
{
//integer
int length = (int)Math.Pow(2, objInfo);
int length = 1 << objInfo;
return new NSNumber(bytes.Slice(offset + 1, length), NSNumber.INTEGER);
}
case 0x2:
{
//real
int length = (int)Math.Pow(2, objInfo);
int length = 1 << objInfo;
return new NSNumber(bytes.Slice(offset + 1, length), NSNumber.REAL);
}
case 0x3:
@@ -427,7 +427,7 @@ namespace Claunia.PropertyList
Debug.WriteLine("BinaryPropertyListParser: Length integer has an unexpected type" + intType +
". Attempting to parse anyway...");
int intInfo = int_type & 0x0F;
int intLength = (int)Math.Pow(2, intInfo);
int intLength = 1 << intInfo;
offsetValue = 2 + intLength;
if(intLength < 3) lengthValue = (int)ParseUnsignedInt(bytes.Slice(offset + 2, intLength));
else