From c12867201ec64f2d227589b5007646088f34fc6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20H=C3=B6rberg?= Date: Wed, 21 Dec 2022 09:48:20 +0100 Subject: [PATCH] Avoid u128 literals MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As they aren't supported in older crystal versions Co-authored-by: Johannes Müller --- src/socket/address.cr | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/socket/address.cr b/src/socket/address.cr index 9c1993d1190e..e2500c2ba2d7 100644 --- a/src/socket/address.cr +++ b/src/socket/address.cr @@ -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