From 40dbb464a3fdacfa40ec38d3c98d9c6271cceee1 Mon Sep 17 00:00:00 2001 From: Frederik Carlier Date: Wed, 12 Jun 2019 16:57:50 +0200 Subject: [PATCH] Use 1 << exp instead of Math.Pow(2, exp) --- plist-cil/BinaryPropertyListParser.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plist-cil/BinaryPropertyListParser.cs b/plist-cil/BinaryPropertyListParser.cs index 4793d46..d743d2c 100644 --- a/plist-cil/BinaryPropertyListParser.cs +++ b/plist-cil/BinaryPropertyListParser.cs @@ -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