Skip to content

Commit

Permalink
bignum fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Isensee committed Dec 19, 2023
1 parent 037a9d3 commit 608921d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/data/specialcased_types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,13 @@ wconvert(::Type{String}, x::BigFloat) = string(x)
rconvert(::Type{BigInt}, x::String) = parse(BigInt, x, base = 62)
rconvert(::Type{BigFloat}, x::String) = parse(BigFloat, x)

# BigInts and BigFloats are defined as mutable structs but should be reconstructed like an
# immutable one. This overrides the default behavior.
function jlconvert(::ReadRepresentation{BN,CustomSerialization{String,Vlen{String}}},
f::JLDFile, ptr::Ptr, header_offset::RelOffset) where BN <: Union{BigInt, BigFloat}
rconvert(BN, jlconvert(ReadRepresentation{String, Vlen{String}}(), f, ptr, header_offset))
end

## Pointers

# Previously it was disallowed to serialize pointers.
Expand Down

0 comments on commit 608921d

Please sign in to comment.