Change the way we do Int64 conversion to/from GAP #357
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously, any Int64 too big to fit into a GAP immediate integer was put into
a T_JULIA wrapper when passed to GAP, and unwrapped later. At the same time,
julia_to_gap
relied completely (and incorrectly) on the C kernel functionsjulia_gap
andgap_julia
to take care of all Int64 values.The result was that passing such an integer as argument to a GAP function did
not work, not even if one explicitly used
julia_to_gap
.To fix this we teach the C kernel function
gap_julia
to convert "large"Int64 values to GAP big integers; this ensures that the many adapter functions
we install for Int64 arguments work.
This means that we violate the principle of roundtrip type fidelity (Int64 -> GAP large
int -> MPtr), but that is a very minor concern.
For really efficient conversions of e.g. Array{Int64,1} to GAP plists, we need
dedicated conversion functions which directly copy over bits. These can be
added transparently in the future.
Finally, we add some minor optimization to julia_to_gap for UInt64, Int128, UInt128