Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion base/gmp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ Base.add_with_overflow(a::BigInt, b::BigInt) = a + b, false
Base.sub_with_overflow(a::BigInt, b::BigInt) = a - b, false
Base.mul_with_overflow(a::BigInt, b::BigInt) = a * b, false

Base.deepcopy_internal(x::BigInt, stackdict::IdDict) = get!(() -> MPZ.set(x), stackdict, x)
Base.deepcopy_internal(x::BigInt, stackdict::IdDict) = get!(() -> MPZ.set(x), stackdict, x)::BigInt

## streamlined hashing for BigInt, by avoiding allocation from shifts ##

Expand Down
2 changes: 1 addition & 1 deletion base/mpfr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1199,7 +1199,7 @@ function Base.deepcopy_internal(x::BigFloat, stackdict::IdDict)
y = _BigFloat(x.prec, x.sign, x.exp, d′)
#ccall((:mpfr_custom_move,libmpfr), Cvoid, (Ref{BigFloat}, Ptr{Limb}), y, d) # unnecessary
return y
end
end::BigFloat
end

function decompose(x::BigFloat)::Tuple{BigInt, Int, Int}
Expand Down
5 changes: 5 additions & 0 deletions test/copy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,11 @@ end
@test (@inferred Base.deepcopy_internal(zeros(), IdDict())) == zeros()
end

@testset "deepcopy_internal big" begin
@inferred Base.deepcopy_internal(big(1), IdDict())
@inferred Base.deepcopy_internal(big(1.0), IdDict())
end

@testset "`copyto!`'s unaliasing" begin
a = view([1:3;], :)
@test copyto!(a, 2, a, 1, 2) == [1;1:2;]
Expand Down