Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
shargon authored Feb 7, 2024
1 parent d65c198 commit e3707fd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Neo.VM/Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ public static long GetBitLength(this BigInteger value)
var b = value.ToByteArray();
if (b.Length == 1 || (b.Length == 2 && b[1] == 0))
{
return BitLen(value.Sign > 0 ? b[0] : (byte)(255 - b[0]));
return BitCount(value.Sign > 0 ? b[0] : (byte)(255 - b[0]));
}
return (b.Length - 1) * 8 + BitLen(value.Sign > 0 ? b[^1] : 255 - b[^1]);
return (b.Length - 1) * 8 + BitCount(value.Sign > 0 ? b[^1] : 255 - b[^1]);
#endif
}

#if !NET5_0_OR_GREATER
[MethodImpl(MethodImplOptions.AggressiveInlining)]
static int BitLen(int w)
private static int BitCount(int w)
{
return w < 1 << 15 ? (w < 1 << 7
? (w < 1 << 3 ? (w < 1 << 1
Expand Down

0 comments on commit e3707fd

Please sign in to comment.