crystal-lang / crystal

The Crystal Programming Language
https://crystal-lang.org
Apache License 2.0
19.21k stars 1.61k forks source link

Remove unnecessary calls to `#unsafe_as(UInt64)` etc. #14686

Closed straight-shoota closed 1 week ago

straight-shoota commented 3 weeks ago

This rewrites some use cases of unsafe_as casting between integer types. These conversions are not unsafe and don't need unsafe_as. They can be expressed with appropriate to_uX! calls.

The different overloads of Hasher#reduce_num could probably be merged to one or two defs. I'll leave that to a follow-up.