From 569413b755372ecffb561dc0659c1bd4cff15526 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Tue, 22 Oct 2024 16:51:22 +0200 Subject: [PATCH] Don't call `fmpz_remove` --- src/flint/fmpq.jl | 8 ++++---- src/flint/fmpz.jl | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/flint/fmpq.jl b/src/flint/fmpq.jl index 4c0edb443..1a9fcb405 100644 --- a/src/flint/fmpq.jl +++ b/src/flint/fmpq.jl @@ -672,25 +672,25 @@ valuation(a::QQFieldElem, b::Integer) = valuation(a, ZZRingElem(b)) function remove!(a::QQFieldElem, b::ZZRingElem) nr = ccall((:fmpq_numerator_ptr, libflint), Ptr{ZZRingElem}, (Ref{QQFieldElem},), a) - vn = ccall((:fmpz_remove, libflint), Clong, (Ptr{ZZRingElem}, Ptr{ZZRingElem}, Ref{ZZRingElem}), nr, nr, b) + vn, nr = remove!(nr, b) #QQFieldElem's are simplified: either num OR den will be non-trivial if vn != 0 return vn, a end nr = ccall((:fmpq_denominator_ptr, libflint), Ptr{ZZRingElem}, (Ref{QQFieldElem},), a) - vn = ccall((:fmpz_remove, libflint), Clong, (Ptr{ZZRingElem}, Ptr{ZZRingElem}, Ref{ZZRingElem}), nr, nr, b) + vn, nr = remove!(nr, b) return -vn, a end function valuation!(a::QQFieldElem, b::ZZRingElem) nr = ccall((:fmpq_numerator_ptr, libflint), Ptr{ZZRingElem}, (Ref{QQFieldElem},), a) - vn = ccall((:fmpz_remove, libflint), Clong, (Ptr{ZZRingElem}, Ptr{ZZRingElem}, Ref{ZZRingElem}), nr, nr, b) + vn, nr = remove!(nr, b) #QQFieldElem's are simplified: either num OR den will be non-trivial if vn != 0 return vn end nr = ccall((:fmpq_denominator_ptr, libflint), Ptr{ZZRingElem}, (Ref{QQFieldElem},), a) - vn = ccall((:fmpz_remove, libflint), Clong, (Ptr{ZZRingElem}, Ptr{ZZRingElem}, Ref{ZZRingElem}), nr, nr, b) + vn, nr = remove!(nr, b) return -vn end diff --git a/src/flint/fmpz.jl b/src/flint/fmpz.jl index 06fb42fc5..4252e300b 100644 --- a/src/flint/fmpz.jl +++ b/src/flint/fmpz.jl @@ -1708,7 +1708,7 @@ function next_prime(x::Int, proved::Bool = true) return x < 2 ? 2 : Int(next_prime(x % UInt, proved)) end -function remove!(a::ZZRingElem, b::ZZRingElem) +function remove!(a::ZZRingElemOrPtr, b::ZZRingElemOrPtr) v = ccall((:fmpz_remove, libflint), Clong, (Ref{ZZRingElem}, Ref{ZZRingElem}, Ref{ZZRingElem}), a, a, b) return v, a end