Skip to content

Commit

Permalink
避免可能出现的错误
Browse files Browse the repository at this point in the history
  • Loading branch information
Perfare committed Apr 15, 2017
1 parent 9984157 commit cf22e31
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions Il2CppDumper/ArmHelper.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Il2CppDumper
{
Expand Down Expand Up @@ -33,12 +31,7 @@ public static ulong decodeAdr(ulong pc, byte[] label)

public static ulong decodeAdrp(ulong pc, byte[] label)
{
var pcbin = Convert.ToString((long)pc, 2);
if (pcbin.Length < 64)
{
pcbin = new string(Enumerable.Repeat('0', 64 - pcbin.Length).Concat(pcbin.ToCharArray()).ToArray());
}
pcbin = pcbin.Substring(0, 52) + new string(Enumerable.Repeat('0', 12).ToArray());
pc &= 0xFFFFFFFFFFFFF000;
var bin = "";
foreach (var b in label)
{
Expand All @@ -52,7 +45,7 @@ public static ulong decodeAdrp(ulong pc, byte[] label)
var uint64 = new string(Enumerable.Repeat(bin[16], 32).ToArray())
+ bin.Substring(17, 7) + bin.Substring(8, 8) + bin.Substring(0, 3) + bin.Substring(25, 2)
+ new string(Enumerable.Repeat('0', 12).ToArray());
return Convert.ToUInt64(pcbin, 2) + Convert.ToUInt64(uint64, 2);
return pc + Convert.ToUInt64(uint64, 2);
}

public static ulong decodeAdd(byte[] ins)
Expand Down

0 comments on commit cf22e31

Please sign in to comment.