1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

compiler/math.bits: use max u64 consts

This commit is contained in:
joe-conigliaro
2020-02-09 19:25:27 +11:00
committed by GitHub
parent 1eeee40278
commit 7583c350b8
4 changed files with 94 additions and 87 deletions

View File

@ -778,7 +778,12 @@ fn (p mut Parser) const_decl() {
// Do not do this when building a module, otherwise the consts
// will not be accessible.
if p.pref.build_mode != .build_module && is_compile_time_const(p.cgen.cur_line) {
p.cgen.const_defines << '#define $name $p.cgen.cur_line'
mut const_val := p.cgen.cur_line
// fix `warning: integer literal is too large to be represented in a signed integer type`
if typ == 'u64' {
const_val = 'UINT64_C($const_val)'
}
p.cgen.const_defines << '#define $name $const_val'
p.cgen.resetln('')
p.fgen_nl()
continue