compiler: remove math dependency
parent
25ef0ee593
commit
67ae167013
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue