@@ -178,7 +178,10 @@ julia> isprime(big(3))
178178true
179179```
180180"""
181- isprime (x:: BigInt , reps= 25 ) = ccall ((:__gmpz_probab_prime_p ,:libgmp ), Cint, (Ptr{BigInt}, Cint), & x, reps) > 0
181+ isprime (x:: BigInt , reps= 25 ) = ccall ((:__gmpz_probab_prime_p ,:libgmp ),
182+ Cint, (Any, Cint), x, reps) > 0
183+ # TODO : Change `Any` to `Ref{BigInt}` when 0.6 support is dropped.
184+ # The two have the same effect but `Ref{BigInt}` won't be optimized on 0.6.
182185
183186
184187# Miller-Rabin witness choices based on:
@@ -535,10 +538,12 @@ end
535538
536539# modify a BigInt in-place
537540function add_! (n:: BigInt , x:: Int )
541+ # TODO : Change `Any` to `Ref{BigInt}` when 0.6 support is dropped.
542+ # The two have the same effect but `Ref{BigInt}` won't be optimized on 0.6.
538543 if x < 0
539- ccall ((:__gmpz_sub_ui , :libgmp ), Void, (Ptr{BigInt}, Ptr{BigInt} , Culong), & n, & n, - x)
544+ ccall ((:__gmpz_sub_ui , :libgmp ), Void, (Any, Any , Culong), n, n, - x)
540545 else
541- ccall ((:__gmpz_add_ui , :libgmp ), Void, (Ptr{BigInt}, Ptr{BigInt} , Culong), & n, & n, x)
546+ ccall ((:__gmpz_add_ui , :libgmp ), Void, (Any, Any , Culong), n, n, x)
542547 end
543548 n
544549end
@@ -571,7 +576,7 @@ julia> nextprime(5, 2)
571576"""
572577function nextprime (n:: Integer , i:: Integer = 1 )
573578 i < 0 && return prevprime (n, - i)
574- i == 0 && throw (DomainError ())
579+ i == 0 && throw (DomainError (i ))
575580 n < 2 && (n = oftype (n, 2 ))
576581 if n == 2
577582 if i <= 1
@@ -646,7 +651,7 @@ julia> prime(3)
646651
647652```
648653"""
649- prime {T<:Integer} (:: Type{T} , i:: Integer ) = i < 0 ? throw (DomainError ()) : nextprime (T (2 ), i)
654+ prime {T<:Integer} (:: Type{T} , i:: Integer ) = i < 0 ? throw (DomainError (i )) : nextprime (T (2 ), i)
650655prime (i:: Integer ) = prime (Int, i)
651656
652657end # module
0 commit comments