-
Notifications
You must be signed in to change notification settings - Fork 3
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
IntegerView(s) #83
Comments
One with...(_:) instead of multiple free-function shims is Greatness™
|
Hm. I've had a hard time getting this to perform well with NBKDoubleWidth (shifts). It appears that NBKStrictBitPattern<UnsafeMutableBufferPointer<UInt>> is slow. I'm not sure why. I got close with NBKStrictBitPattern<UnsafeMutableWords>, however, where UnsafeMutableWords is a custom NBKDoubleWidth pointer. |
I'm basically hoping I can turn these into views when Swift gets those, that would be great. Maybe I should still go the custom-NBKDoubleWidth-pointer route until then, because the need for static methods is so silly. Hm. I'll think about it. |
So I realized something. Given how binary integers are tree-like, I could wrap sub-views in super-views. Maybe the compiler likes that better than converting back and forth between views? Conversions seem like they might require lots of ownership fiddling that isn't possible in Swift 5.7 or 5.8. Maybe I can do something cool with Edit: Doesn't seem like wrapping performs any better or worse (maybe non-pointers care). Edit: Nope. Nope. Nope. |
Free functions are hard to beat. Should I use static methods and retry when Swift gets proper views? Hm. |
I kept the namespaces but removed the views. I feel like the namespaces help keep things nice and tidy. |
I need lots of free-function-y stuff to get things done without tying myself to any particular implementation. But free-function-y stuff is messy. The function signatures get way too long or way too terse. It is difficult to track, and tracking preconditions is worse.
So I've been thinking. I might want integer-view-y stuff instead, so things get neatly encapsulated, preconditions get checked on instantiation, and the type system can help out. I imagine these generic over various collections, but I probably need borrowing and consuming for that. I suppose mutable buffer pointers might do.
The text was updated successfully, but these errors were encountered: