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

checker: restrict numeric promotions to cases where no data is lost

This commit is contained in:
Uwe Krüger
2020-05-27 05:42:48 +02:00
committed by GitHub
parent fc67046bac
commit 013fdb8a4b
81 changed files with 510 additions and 247 deletions

View File

@ -360,9 +360,9 @@ pub fn (b []byte) hex() string {
mut dst_i := 0
for i in b {
n0 := i >> 4
hex[dst_i++] = if n0 < 10 { n0 + `0` } else { n0 + 87 }
hex[dst_i++] = if n0 < 10 { n0 + `0` } else { n0 + byte(87) }
n1 := i & 0xF
hex[dst_i++] = if n1 < 10 { n1 + `0` } else { n1 + 87 }
hex[dst_i++] = if n1 < 10 { n1 + `0` } else { n1 + byte(87) }
}
hex[dst_i] = `\0`
return tos(hex,dst_i)