úÎÁX³ê‰      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ(c) Herbert Valerio Riedel 2014BSD3ghc-devs@haskell.org provisionalnon-portable (GHC Extensions)None *1DV`pæS Construct & value from list of ‰s..This function is used by GHC for constructing & literals.Should rather be called  intToInteger Truncates & to least-significant ŠAdd two &s Multiply two &s Subtract one & from another.Negate & Compute absolute value of an & Return -1, 0, and 1L depending on whether argument is negative, zero, or positive, respectively Simultaneous  and .aDivisor must be non-zero otherwise the GHC runtime will terminate with a division-by-zero fault. Simultaneous  and .aDivisor must be non-zero otherwise the GHC runtime will terminate with a division-by-zero fault. Compute greatest common divisor.Compute least common multiple.Bitwise AND operationBitwise OR operationBitwise XOR operation Bitwise NOT operation!Shift-left operation-Even though the shift-amount is expressed as Š6, the result is undefined for negative shift-amounts." Arithmetic shift-right operation-Even though the shift-amount is expressed as Š6, the result is undefined for negative shift-amounts.%& for which only n2-th bit is set. Undefined behaviour for negative n values.& Invariant: ) and (# are used iff value doesn't fit in '0Useful properties resulting from the invariants: abs (' _) <= abs (( _) abs (' _) < abs () _)' iff value in  [minBound::‰ , maxBound::‰] range‹"Internal helper type for "signed" *sXThis is a useful abstraction for operations which support negative mp_size_t arguments.( iff value in  ]maxBound::‰, +inf[ range) iff value in ]-inf, minBound::‰[ range*Type representing raw arbitrary-precision NaturalsThis is common type used by Natural and &=. As this type consists of a single constructor wrapping a Œ it can be unpacked.Essential invariants:Œ size is an exact multiple of  size7limbs are stored in least-significant-limb-first order,6the most-significant limb must be non-zero, except for0" which is represented as a 1-limb.- Count of /1s, must be positive (unless specified otherwise)./Type representing a GMP Limb0 Version of m operating on s1 Version of j operating on sŽ Bits in a / . Same as 64.26Test whether all internal invariants are satisfied by & valueReturns 1# if valid, 0# otherwise.NThis operation is mostly useful for test-suites and/or code which constructs & values directly.5Not-equal predicate.Return -1#, 0#, and 1#L depending on whether argument is negative, zero, or positive, respectively;Square & Construct & from the product of two Šs>hCount number of set bits. For negative arguments returns negative population count of negated argument.?Test if n-th bit is set.@ Compute greatest common divisor.Warning<: result may become negative if (at least) one argument is minBoundA Compute greatest common divisor.ISame as p bn 0#JEquivalent to ‘ . IKCAF representing the value  0 :: BigNatLTest if * value is equal to zero.MCAF representing the value  1 :: BigNatN?Special 0-sized bigNat returned in case of arithmetic underflow<This is currently only returned by the following operations:TUOther operations such as b may return N3 as well as a dummy/place-holder value instead of  undefinedQ since we can't throw exceptions. But that behaviour should not be relied upon.NB: isValidBigNat# nullBigNat is falseOTest for special 0-sized * representing underflows.PConstruct 1-limb * from QPConstruct BigNat from 2 limbs. The first argument is the most-significant limb.TReturns N (see O) in case of underflowUReturns N (see O) in case of underflowWSquare *YSpecialised version of +bitBigNat = shiftLBigNat (wordToBigNat 1##)$avoiding a few redundant allocations’aka x y -> x .&. (complement y)aIf divisor is zero, (# N, N #) is returneddNote: Result of div/0 undefinedfdiv/0 not checkediExtended euclidean algorithm.For a and b(, compute their greatest common divisor g and the coefficient s satisfying as + bt = g.j"j b e m" computes base b raised to exponent e modulo abs(m).6Negative exponents are supported if an inverse modulo m exists.WarningÕ: It's advised to avoid calling this primitive with negative exponents unless it is guaranteed the inverse exists, as failure to do so will likely cause program abortion due to a divide-by-zero fault. See also m.Future versions of  integer_gmp may not support negative e values anymore.k Version of j operating on *sl Version of j for  -sized modulim"m x m" computes the inverse of x modulo m+. If the inverse exists, the return value y will satisfy 0 < y < abs(m), otherwise the result is 0.n Version of m operating on *so$Return number of limbs contained in *.pExtract n-th (0-based) limb in *. n' must be less than size as reported by o.“May shrink underlyng Œ& if needed to satisfy BigNat invariant” Shrink MBN• Version of – which scans all allocated  MutBigNat#–¶Find most-significant non-zero limb and return its index-position plus one. Start scanning downward from the initial limb-size (i.e. start-index plus one) given as second argument.NB: The normSizeofMutBigNat of K would be 0#q Construct * from existing Œ containing n /#s in least-significant-first order. If possible Œ&, will be used directly (i.e. shared without cloning the Œ into a newly allocated one)Note: size parameter (times sizeof(GmpLimb) ) must be less or equal to its —.rRead &( (without sign) from memory location at addr in base-256 representation. r addr size msbfSee description of t for more details.s Version of r constructing a *˜ Helper for stRead &; (without sign) from byte-array in base-256 representation.The call t ba offset size msbfreadssize bytes from the Œ ba starting at offset$with most significant byte first if msbf is 1#' or least significant byte first if msbf is 0#, andreturns a new &u Version of t constructing a *™ Helper for uv6Test whether all internal invariants are satisfied by * valueReturns 1# if valid, 0# otherwise.NThis operation is mostly useful for test-suites and/or code which constructs & values directly.w Version of nextPrimeInteger operating on *sšAbsolute value of ‹›Signed4 limb count. Negative sizes denote negative integersœ Construct ‹ from Š valueConvert & into ‹žConvert ‹ into &sign of integer (Ÿ if non-negative)nabsolute value expressed in 31 bit chunks, least significant first (ideally these would be machine-word  s rather than 31-bit truncated ‰s)Ù  !"#$%&)('‹¡¢£€¥*+Чš©,-./ª«¬­®¯°±²³Žµ¶·ž¹º»ŒœŸ¿ÀÁÂÃÄÅÆÇÈÉÊË0ÌÍ1Îώ234Ð56789:;<=>?Ñ@ABCDEFÒGHIJKLMÓNOPQRSTUVWXYZÔ[\]Õ^_’`abcdefghiÖjklרmnÙoÚÛÜpÝÞßà“”á•–qrs˜tu™vwâãäåæçè際œžêëìíîïðñ&'()‹¢¡€¥*+â0ã1ä1None Dêx6Calculate the integer logarithm for an arbitrary base.The base must be greater than 1v, the second argument, the number whose logarithm is sought, shall be positive, otherwise the result is meaningless.The following property holds base ^ x base m <= m < base ^(x base m + 1)for base > 1 and m > 0.Note: Internally uses y for base 2y-Calculate the integer base 2 logarithm of an &|. The calculation is more efficient than for the general case, on platforms with 32- or 64-bit words much more efficient.:The argument must be strictly positive, that condition is not checked.zCompute base-2 log of JThis is internally implemented as count-leading-zeros machine instruction.xyzzyxNoneD‚™òExtended version of y(Assumption: Integer is strictly positiveFirst component of result is log2 n , second is 0# iff n is a power of two.yzòó(c) Herbert Valerio Riedel 2014BSD3ghc-devs@haskell.org provisionalnon-portable (GHC Extensions)NoneD„s,  !"#$&356789:?,&#$ 65798:  !"?3(c) Herbert Valerio Riedel 2014BSD3ghc-devs@haskell.org provisionalnon-portable (GHC Extensions)None 01D°`{ Version of ˆ operating on s| Version of † operating on s} Version of ~ operating on ~1Compute number of digits (without sign) in given base.This function wraps mpz_sizeinbase()B which has some implementation pecularities to take into account:"~ 0 base = 1" (see also comment in ƒ).!This function is only defined if base >= 2# and base <= 256#. (Note: the documentation claims that only base <= 62#M is supported, however the actual implementation supports up to base 256).If baseH is a power of 2, the result will be exact. In other cases (e.g. for base = 10#), the result may# be 1 digit too large sometimes."~ i 2#:" can be used to determine the most significant bit of i. Version of ~ operating on *€Dump & (without sign) to addr in base-256 representation. € i addr eSee description of ƒ for more details. Version of € operating on *s.‚ Version of € operating on  s.ƒDump &B (without sign) to mutable byte-array in base-256 representation.The call ƒ i mba offset msbfwritesthe & i into the ô mba starting at offset$with most significant byte first if msbf is 1#' or least significant byte first if msbf is 0#, and returns number of bytes written.Use "~ i 256#?" to compute the exact number of bytes written in advance for i /= 0 . In case of i == 0, ƒ4 will write and report zero bytes written, whereas ~ report one byte."It's recommended to avoid calling ƒe for small integers as this function would currently convert those to big integers in msbf to call  mpz_export().„ Version of ƒ operating on *s.… Version of ƒ operating on  s.†(Probalistic Miller-Rabin primality test."† n k" determines whether n4 is prime and returns one of the following results:2# is returned if n is definitely prime,1# if n is a probable prime, or0# if n is definitely not a prime.The kI argument controls how many test rounds are performed for determining a probable prime. For more details, see  ahttp://gmplib.org/manual/Number-Theoretic-Functions.html#index-mpz_005fprobab_005fprime_005fp-360,GMP documentation for `mpz_probab_prime_p()`.‡ Version of † operating on *sˆ Compute next prime greater than n probalistically.=According to the GMP documentation, the underlying function mpz_nextprime()˜ "uses a probabilistic algorithm to identify primes. For practical purposes it's adequate, the chance of a composite passing will be extremely small."†  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvw{|}~€‚ƒ„…†‡ˆ[&'()2%>i;jm4<=*+/.-,voKMNqPQJIpRSTUVXWadebcfhgkln]\Z`_[^YLOCBGHEFD@A10†‡|ˆw{~}€‚„ƒ…srutõ      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”’•’–—˜™’š›œžŸ’ ¡¢£€¥Š§š©ª«¬­®¯°±²³Žµ¶·ž¹º»ŒœŸ¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûü’ýþ integer-gmp GHC.IntegerGHC.Integer.GMP.InternalsGHC.Integer.LogarithmsGHC.Integer.Type GHC.Integer.Logarithms.Internals mkInteger smallInteger integerToWord integerToInt plusInteger timesInteger minusInteger negateInteger eqInteger# neqInteger# absInteger signumInteger leInteger# gtInteger# ltInteger# geInteger#compareInteger quotInteger remInteger divInteger modInteger divModIntegerquotRemIntegerfloatFromIntegerdoubleFromIntegerencodeFloatIntegerencodeDoubleInteger gcdInteger lcmInteger andInteger orInteger xorIntegercomplementInteger shiftLInteger shiftRInteger wordToIntegerdecodeDoubleInteger bitIntegerIntegerS#Jp#Jn#BigNatBN#GmpSize#GmpSizeGmpLimb#GmpLimb recipModWord powModWordisValidInteger# hashIntegerwordToNegInteger neqInteger eqInteger leInteger ltInteger gtInteger geInteger sqrIntegerbigNatToIntegerbigNatToNegIntegerpopCountIntegertestBitIntegergcdIntgcdWord compareBigNatcompareBigNatWord gtBigNatWord#eqBigNat eqBigNat# eqBigNatWord eqBigNatWord# bigNatToWord bigNatToInt zeroBigNat isZeroBigNat oneBigNat nullBigNat isNullBigNat# wordToBigNat wordToBigNat2 plusBigNatplusBigNatWord minusBigNatminusBigNatWord timesBigNat sqrBigNattimesBigNatWord bitBigNat testBitBigNatpopCountBigNat shiftLBigNat shiftRBigNatorBigNat xorBigNat andBigNat quotRemBigNat quotBigNat remBigNatquotRemBigNatWordquotBigNatWord remBigNatWord gcdBigNatWord gcdBigNat gcdExtInteger powModInteger powModBigNatpowModBigNatWordrecipModIntegerrecipModBigNat sizeofBigNat# indexBigNat#byteArrayToBigNat#importIntegerFromAddrimportBigNatFromAddrimportIntegerFromByteArrayimportBigNatFromByteArrayisValidBigNat#nextPrimeBigNatintegerLogBase# integerLog2# wordLog2#nextPrimeWord#testPrimeWord#sizeInBaseWord#sizeInBaseIntegersizeInBaseBigNatexportIntegerToAddrexportBigNatToAddrexportWordToAddrexportIntegerToMutableByteArrayexportBigNatToMutableByteArrayexportWordToMutableByteArraytestPrimeIntegertestPrimeBigNatnextPrimeIntegerghc-prim GHC.TypesIntGHC.PrimInt#SBigNat ByteArray#Word# gmpLimbBitssignumInteger#timesInt2Integer word2Int# andnBigNatunsafeRenormFreezeBigNat#unsafeShrinkFreezeBigNat#normSizeofMutBigNat#normSizeofMutBigNat'#sizeofByteArray#importBigNatFromAddr#importBigNatFromByteArray# absSBigNatssizeofSBigNat# intToSBigNat#integerToSBigNatsBigNatToIntegerTrueWordPosBNNegBNS MutBigNatMBN#CInt#CInt GmpBitCnt# GmpBitCnt nextPrime#c_mpn_import_bytearrayc_rscan_nzbyte_bytearrayc_scan_nzbyte_bytearrayc_mpn_import_addrc_rscan_nzbyte_addrc_scan_nzbyte_addrc_mpn_popcount c_mpn_xor_n c_mpn_ior_n c_mpn_andn_n c_mpn_and_n c_mpn_lshiftc_mpn_rshift_2c c_mpn_rshift c_mpn_mod_1c_mpn_divrem_1 c_mpn_tdiv_r c_mpn_tdiv_q c_mpn_tdiv_qr c_mpn_cmp c_mpn_mul c_mpn_sub c_mpn_add c_mpn_mul_1 c_mpn_sub_1 c_mpn_add_1integer_gmp_gcdext# c_mpn_gcd# c_mpn_gcd_1#gcdWord# c_mpn_get_dint_encodeDouble#integer_gmp_invert#integer_gmp_powm1#integer_gmp_powm#narrowGmpSize# narrowCInt# isNegInteger# unsafePromote neqBigNat# czeroBigNattestBitNegBigNatshiftRNegBigNat gcdExtSBigNat powModSBigNatpowModSBigNatWordrecipModSBigNatgetSizeofMutBigNat# newBigNat# writeBigNat#unsafeFreezeBigNat#resizeMutBigNat#shrinkMutBigNat#unsafeSnocFreezeBigNat#copyWordArray#$>>=>>svoidreturnliftIOrunSfailcmpW#bitWord# testBitWord#popCntI#absI#sgnI#cmpI#minI#integerLog2IsPowerOf2# roundingMode#MutableByteArray#