From 67ae1670131cd51d11bd82eb9df46efcff401cfc Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Fri, 11 Oct 2019 03:12:34 +0300 Subject: [PATCH] compiler: remove math dependency --- compiler/table.v | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/compiler/table.v b/compiler/table.v index ead5aec864..64ee74dca8 100644 --- a/compiler/table.v +++ b/compiler/table.v @@ -5,7 +5,7 @@ module main import os -import math +//import math import strings struct Table { @@ -778,14 +778,14 @@ fn (table &Table) cgen_name_type_pair(name, typ string) string { fn is_valid_int_const(val, typ string) bool { x := val.int() switch typ { - case 'byte': return 0 <= x && x <= math.MaxU8 - case 'u16': return 0 <= x && x <= math.MaxU16 + case 'byte': return 0 <= x && x <= 255 + case 'u16': return 0 <= x && x <= 65535 //case 'u32': return 0 <= x && x <= math.MaxU32 //case 'u64': return 0 <= x && x <= math.MaxU64 ////////////// - case 'i8': return math.MinI8 <= x && x <= math.MaxI8 - case 'i16': return math.MinI16 <= x && x <= math.MaxI16 - case 'int': return math.MinI32 <= x && x <= math.MaxI32 + case 'i8': return -128 <= x && x <= 127 + case 'i16': return -32768 <= x && x <= 32767 + case 'int': return -2147483648 <= x && x <= 2147483647 //case 'i64': //x64 := val.i64() //return i64(-(1<<63)) <= x64 && x64 <= i64((1<<63)-1)