Advertisement
TizzyT

BigInteger BitLength - TizzyT

Feb 16th, 2014
1,115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.37 KB | None | 0 0
  1. ''' BigInteger Bit Length '''
  2.     Private Function BitLen(ByVal TestingNbr As BigInteger) As BigInteger
  3.         Dim Nbr As String = TestingNbr.ToString("X")
  4.         BitLen = Convert.ToString(Convert.ToInt32(Nbr(0), 16), 2).TrimStart("0").Length
  5.         BitLen = BigInteger.Add(BitLen, BigInteger.Multiply(New BigInteger(4), New BigInteger(Nbr.Length - 1)))
  6.     End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement