-
Notifications
You must be signed in to change notification settings - Fork 638
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
ByteBuffer uses UInt for Capacity, but Int internally
#499
Comments
|
ha, that's fun. We chose @lorentey / @airspeedswift / @moiseev what do you propose? |
|
I think the most pragmatic approach is to limit counts and sizes to values that fit in a signed integer. (>=2GiB buffers are probably unlikely to occur in practice on 32-bit platforms, anyway.) |
|
I'm happy with saying that |
|
I think a current Raspi comes with 1gb and usually no swap. In other words: I agree, 2gb is enough for everybody. |
|
No objection from me. |
|
@helje5 I think we now all agree that 2GB is enough for 32bit so I'll close this, ok? |
|
Sure, fine with me. |
Separated out of #486, ByteBuffer-core.swift has this:
where
CapacityisThis can fail on 32-bit platforms where
Intcannot hold anyUInt32value (e.g. 0xDEADBEEF). Apparently theIntis used because of:TBD: What should be used here. Maybe
size_t? That would be better, but theoretically it would still break ByteBuffer on platforms wheresize_tis less thanUInt32, e.g.Int32sounds at least possible forsize_t.Presumably
Intis also often used in Swift itself (e.g. the capacity of aUnsafeBufferPointeris probably anInt?)The text was updated successfully, but these errors were encountered: