コード例 #1
0
 /// <summary>
 /// Create a new integer, importing it from an array of input values and setting the sign.
 /// The most significant byte is given first.
 /// This option is here for saving and loading the integer.
 /// The sign is specified seperately because GMP uses magnitude/sign format.
 /// </summary>
 public GmpInteger(byte[] initialValue, bool isNegative = false)
 {
     if (initialValue == null) throw new ArgumentException("initialValue");
     Interop.mpz_import(ref _Storage, initialValue.Length, 1, 1, 0, 0, initialValue);
     if (isNegative) {
         mpz_t negStorage = new mpz_t();
         Interop.mpz_neg(ref negStorage, ref _Storage);
         Interop.mpz_clear(ref _Storage);
         _Storage = negStorage;
     }
     DisposeContext.AddDisposeObject(this);
 }
コード例 #2
0
 /// <summary>
 /// Create a new integer, importing it from an array of input values and setting the sign.
 /// The most significant byte is given first.
 /// This option is here for saving and loading the integer.
 /// The sign is specified seperately because GMP uses magnitude/sign format.
 /// </summary>
 public GmpInteger(byte[] initialValue, bool isNegative = false)
 {
     if (initialValue == null)
     {
         throw new ArgumentException("initialValue");
     }
     Interop.mpz_import(ref _Storage, initialValue.Length, 1, 1, 0, 0, initialValue);
     if (isNegative)
     {
         mpz_t negStorage = new mpz_t();
         Interop.mpz_neg(ref negStorage, ref _Storage);
         Interop.mpz_clear(ref _Storage);
         _Storage = negStorage;
     }
     DisposeContext.AddDisposeObject(this);
 }
コード例 #3
0
ファイル: Interop.cs プロジェクト: WCoetser/BigFasterInteger
 public static extern int mpz_sizeinbase(ref mpz_t op, int base_);
コード例 #4
0
ファイル: Interop.cs プロジェクト: WCoetser/BigFasterInteger
 public static extern void mpz_mod(ref mpz_t rop, ref mpz_t op1, ref mpz_t op2);
コード例 #5
0
ファイル: Interop.cs プロジェクト: WCoetser/BigFasterInteger
 public static extern void mpz_sub(ref mpz_t w, ref mpz_t u, ref mpz_t v);
コード例 #6
0
ファイル: Interop.cs プロジェクト: WCoetser/BigFasterInteger
 public static extern void mpz_sub(ref mpz_t w, ref mpz_t u, ref mpz_t v);
コード例 #7
0
ファイル: Interop.cs プロジェクト: WCoetser/BigFasterInteger
 public static extern void mpz_neg(ref mpz_t negV, ref mpz_t v);
コード例 #8
0
ファイル: Interop.cs プロジェクト: WCoetser/BigFasterInteger
 public static extern bool mpz_init(ref mpz_t x);
コード例 #9
0
ファイル: Interop.cs プロジェクト: WCoetser/BigFasterInteger
 public static extern bool mpz_clear(ref mpz_t x);
コード例 #10
0
ファイル: Interop.cs プロジェクト: WCoetser/BigFasterInteger
 public static extern IntPtr mpz_export(byte[] rop, ref int countp, int order, int size, int endian, int nails, ref mpz_t op);
コード例 #11
0
ファイル: Interop.cs プロジェクト: WCoetser/BigFasterInteger
 public static extern IntPtr mpz_get_str([MarshalAs(UnmanagedType.LPStr)] StringBuilder str, int base_, ref mpz_t op);
コード例 #12
0
ファイル: Interop.cs プロジェクト: WCoetser/BigFasterInteger
 public static extern bool mpz_clear(ref mpz_t x);
コード例 #13
0
ファイル: Interop.cs プロジェクト: WCoetser/BigFasterInteger
 public static extern int mpz_cmp(ref mpz_t op1, ref mpz_t op2);
コード例 #14
0
ファイル: Interop.cs プロジェクト: WCoetser/BigFasterInteger
 public static extern void mpz_add(ref mpz_t w, ref mpz_t u, ref mpz_t v);
コード例 #15
0
ファイル: Interop.cs プロジェクト: WCoetser/BigFasterInteger
 public static extern void mpz_abs(ref mpz_t absV, ref mpz_t v);
コード例 #16
0
ファイル: Interop.cs プロジェクト: WCoetser/BigFasterInteger
 public static extern void mpz_tdiv_q(ref mpz_t q, ref mpz_t n, ref mpz_t d);
コード例 #17
0
ファイル: Interop.cs プロジェクト: WCoetser/BigFasterInteger
 public static extern IntPtr mpz_get_str([MarshalAs(UnmanagedType.LPStr)] StringBuilder str, int base_, ref mpz_t op);
コード例 #18
0
ファイル: Interop.cs プロジェクト: WCoetser/BigFasterInteger
 public static extern void mpz_import(ref mpz_t rop, int count, int order, int size, int endian, int nails, byte[] op);
コード例 #19
0
ファイル: Interop.cs プロジェクト: WCoetser/BigFasterInteger
 public static extern IntPtr mpz_export(byte[] rop, ref int countp, int order, int size, int endian, int nails, ref mpz_t op);
コード例 #20
0
ファイル: Interop.cs プロジェクト: WCoetser/BigFasterInteger
 public static extern bool mpz_init(ref mpz_t x);
コード例 #21
0
ファイル: Interop.cs プロジェクト: WCoetser/BigFasterInteger
 public static extern int mpz_set_str(ref mpz_t rop, string str, int base_);
コード例 #22
0
ファイル: Interop.cs プロジェクト: WCoetser/BigFasterInteger
 public static extern void mpz_mul(ref mpz_t rop, ref mpz_t op1, ref mpz_t op2);
コード例 #23
0
ファイル: Interop.cs プロジェクト: WCoetser/BigFasterInteger
 public static extern void mpz_add(ref mpz_t w, ref mpz_t u, ref mpz_t v);
コード例 #24
0
ファイル: Interop.cs プロジェクト: WCoetser/BigFasterInteger
 public static extern void mpz_mul_2exp(ref mpz_t rop, ref mpz_t op1, uint op2);
コード例 #25
0
ファイル: Interop.cs プロジェクト: WCoetser/BigFasterInteger
 public static extern void mpz_abs(ref mpz_t absV, ref mpz_t v);
コード例 #26
0
ファイル: Interop.cs プロジェクト: WCoetser/BigFasterInteger
 public static extern int mpz_cmp(ref mpz_t op1, ref mpz_t op2);
コード例 #27
0
ファイル: Interop.cs プロジェクト: WCoetser/BigFasterInteger
 public static extern void mpz_mul_2exp(ref mpz_t rop, ref mpz_t op1, uint op2);
コード例 #28
0
ファイル: Interop.cs プロジェクト: WCoetser/BigFasterInteger
 public static extern int mpz_set_str(ref mpz_t rop, string str, int base_);
コード例 #29
0
ファイル: Interop.cs プロジェクト: WCoetser/BigFasterInteger
 public static extern void mpz_tdiv_q(ref mpz_t q, ref mpz_t n, ref mpz_t d);
コード例 #30
0
ファイル: Interop.cs プロジェクト: WCoetser/BigFasterInteger
 public static extern int mpz_sizeinbase(ref mpz_t op, int base_);
コード例 #31
0
ファイル: Interop.cs プロジェクト: WCoetser/BigFasterInteger
 public static extern void mpz_import(ref mpz_t rop, int count, int order, int size, int endian, int nails, byte[] op);
コード例 #32
0
ファイル: Interop.cs プロジェクト: WCoetser/BigFasterInteger
 public static extern void mpz_neg(ref mpz_t negV, ref mpz_t v);