-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove calls to Pointer.new(Int)
#14683
Remove calls to Pointer.new(Int)
#14683
Conversation
Do you think this is fine for 32-bit targets or even AVR? |
Yes, it's fine. This is not changing anything from the current status. So compatibility with smaller architectures is not really relevant to this PR. Everything that worked before this PR, should continue to work.
Lines 421 to 423 in 897bd10
This patch merely pulls out the cast A portable implementation would be possible with a |
The one advantage is that now these pointer constants will be actual consts, and no more wrapped in a Crystal::Once to be defined at runtime. Though I'm wondering if we couldn't introduce a |
@ysbaddaden Yes, I think we should do that. But it's a separate change. We can easily come back to update these definitions then. And there'll be a lot more which need this treatment. |
Are you sure it's separate? Introducing a target specific Pointer::Size might be, but introducing a hardcoded Pointer::Size as UInt64 seems like it would fit just right in to me. |
IMO introducing |
This is a preparatory step to dropping the overload
Pointer.new(Int)
(#14669). It replaces all calls to this overloads with explicit casts toUInt64
at the call site, which ends up resolving to the main overloadPointer.new(UInt64)
.