From 093d8a2b0035235344126ef97ddebddf068a9bbf Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Mon, 14 Oct 2019 08:34:44 +0300 Subject: [PATCH] compiler: remove math dependency --- Makefile | 2 +- vlib/compiler/table.v | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 50befb0778..1035c71e5e 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ fresh_vc: fresh_tcc: rm -rf /var/tmp/tcc/ - git clone --depth 1 --quiet https://github.com/vmisc/tccbin /var/tmp/tcc + git clone --depth 1 --quiet https://github.com/vlang/tccbin /var/tmp/tcc selfcompile: ./v v.v diff --git a/vlib/compiler/table.v b/vlib/compiler/table.v index a706a52b79..5acf8b3700 100644 --- a/vlib/compiler/table.v +++ b/vlib/compiler/table.v @@ -5,7 +5,6 @@ module compiler import os -import math import strings struct Table { @@ -778,14 +777,16 @@ 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.max_u8 - case 'u16': return 0 <= x && x <= math.max_u16 + 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.min_i8 <= x && x <= math.max_i8 + case 'i8': return -128 <= x && x <= 127 + /* case 'i16': return math.min_i16 <= x && x <= math.max_i16 case 'int': return math.min_i32 <= x && x <= math.max_i32 + */ //case 'i64': //x64 := val.i64() //return i64(-(1<<63)) <= x64 && x64 <= i64((1<<63)-1)