From c9a9d631e0b76e7bfb7aea61b73b4f8b74efebe9 Mon Sep 17 00:00:00 2001 From: Sijawusz Pur Rahnama Date: Sat, 6 Jan 2018 00:00:37 +0100 Subject: [PATCH] Use (U)Int128 literals if possible --- src/int.cr | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/int.cr b/src/int.cr index 00454ab97774..bfd82bbc0432 100644 --- a/src/int.cr +++ b/src/int.cr @@ -666,9 +666,8 @@ struct Int64 end struct Int128 - # TODO: eventually update to literals once UInt128 bit support is finished - MIN = new(1) << 127 - MAX = ~MIN + MIN = -170141183460469231731687303715884105728_i128 + MAX = 170141183460469231731687303715884105727_i128 # Returns an `Int128` by invoking `to_i128` on *value*. def self.new(value) @@ -676,8 +675,7 @@ struct Int128 end def - - # TODO: use 0_i128 - self - Int128.new(0) - self + 0_i128 - self end def popcount @@ -778,9 +776,8 @@ struct UInt64 end struct UInt128 - # TODO: eventually update to literals once UInt128 bit support is finished - MIN = new 0 - MAX = ~MIN + MIN = 0_u128 + MAX = 340282366920938463463374607431768211455_u128 # Returns an `UInt128` by invoking `to_u128` on *value*. def self.new(value)