aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2018-10-28 22:18:58 -0300
committerGitHub <noreply@github.com>2018-10-28 22:18:58 -0300
commit5b13ee655c4abef8b708319660796229788efcae (patch)
tree422e40d41047805a5621f034fe4e36aeca55aeb0
parentc1b7340023b42161d55993de2e40baad68915b86 (diff)
Fix the rotate right method on ABitUtils (#486)
-rw-r--r--ChocolArm64/ABitUtils.cs18
1 files changed, 3 insertions, 15 deletions
diff --git a/ChocolArm64/ABitUtils.cs b/ChocolArm64/ABitUtils.cs
index dd416235..a2654c20 100644
--- a/ChocolArm64/ABitUtils.cs
+++ b/ChocolArm64/ABitUtils.cs
@@ -2,18 +2,6 @@ namespace ChocolArm64
{
static class ABitUtils
{
- public static int CountBitsSet(long Value)
- {
- int Count = 0;
-
- for (int Bit = 0; Bit < 64; Bit++)
- {
- Count += (int)(Value >> Bit) & 1;
- }
-
- return Count;
- }
-
public static int HighestBitSet32(int Value)
{
for (int Bit = 31; Bit >= 0; Bit--)
@@ -50,12 +38,12 @@ namespace ChocolArm64
public static long RotateRight(long Bits, int Shift, int Size)
{
- return (Bits >> Shift) | (Bits << (Size - Shift));
+ return (long)RotateRight((ulong)Bits, Shift, Size);
}
- public static bool IsPow2(int Value)
+ public static ulong RotateRight(ulong Bits, int Shift, int Size)
{
- return Value != 0 && (Value & (Value - 1)) == 0;
+ return (Bits >> Shift) | (Bits << (Size - Shift));
}
}
}