From e7969b7658e121d3c32d4f1dc0c62443a4cc2ef5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Mon, 30 Sep 2024 14:13:37 +0200 Subject: [PATCH] Reduce allocations in `QQFieldElem` construction --- src/flint/fmpq.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/flint/fmpq.jl b/src/flint/fmpq.jl index 5a865f6b2..ed658969b 100644 --- a/src/flint/fmpq.jl +++ b/src/flint/fmpq.jl @@ -20,7 +20,7 @@ end QQFieldElem(a::Rational{T}) where {T <: Integer} = QQFieldElem(numerator(a), denominator(a)) -QQFieldElem(a::Integer) = QQFieldElem(ZZRingElem(a), ZZRingElem(1)) +QQFieldElem(a::Integer) = QQFieldElem(flintify(a)) QQFieldElem(a::Integer, b::Integer) = QQFieldElem(ZZRingElem(a), ZZRingElem(b)) @@ -1191,7 +1191,7 @@ end # ############################################################################### -(a::QQField)() = QQFieldElem(ZZRingElem(0), ZZRingElem(1)) +(a::QQField)() = zero(a) function (a::QQField)(b::Rational) # work around Julia bug, https://github.com/JuliaLang/julia/issues/32569