BigInteger RRS feed

  • Question

  • In the .net source code, I find file BigInteger.cs containing 'Internal int _size;' and 'Internal uint[] _bits;'  I need a version of Biginteger with these properties public.  The reason is performance.  I need to extract (readonly access is all I need) a some low and/or high order bytes from a BigInteger, and ToByteArray and other alternatives take too long.  I realize that anything I make with such a version may break in a subsequent .net release, and that is ok with me.  I don't intend to distribute anything - this is about some experimental mathematical code that ultimately is throw-away, but it needs to be faster than it is now.

    I don't speak C# so well, and it looks like I'd have to mess with BigInteger.cs and BigIntegerBuilder.cs, and I don't know what else.  Can anyone help me out with this?

    Tuesday, January 5, 2016 12:53 AM


  • You can't do anything to make change Internal fields into Public fields in the compiled BigInteger class found in the .Net Framework. If you need a class that is similar to BigInteger but with those fields publicly accessible, you will hav eto write your own (presumably with the help of the source file you are studying).
    • Proposed as answer by Kristin Xie Friday, January 8, 2016 8:45 AM
    • Marked as answer by DotNet Wang Tuesday, January 19, 2016 1:13 AM
    Tuesday, January 5, 2016 2:44 AM