Skip to content

Commit

Permalink
Reduce allocations in QQFieldElem construction (#1872)
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens authored Sep 30, 2024
1 parent 05e38da commit 40d7365
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/flint/fmpq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 40d7365

Please sign in to comment.