Skip to content

Commit

Permalink
Avoid u128 literals
Browse files Browse the repository at this point in the history
As they aren't supported in older crystal versions

Co-authored-by: Johannes Müller <[email protected]>
  • Loading branch information
carlhoerberg and straight-shoota authored Dec 21, 2022
1 parent 3a87d82 commit c128672
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/socket/address.cr
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,9 @@ class Socket
in LibC::In6Addr
addr8 = ipv6_addr8(addr)
num = addr8.unsafe_as(UInt128)
num == (1_u128 << 120) || # "::1"
num & 0xffffffffffffffffffffffffff_u128 == 0x7fffff00000000000000000000_u128 # "::ffff:127.0.0.1/104"
# TODO: Use UInt128 literals
num == (1_u128 << 120) || # "::1"
num & UInt128::MAX >> 24 == 0x7fffff_u128 << 80 # "::ffff:127.0.0.1/104"
end
end

Expand Down

0 comments on commit c128672

Please sign in to comment.