cgen: operator overloading

This commit is contained in:
Alexander Medvednikov 2020-04-08 22:12:42 +02:00
parent 3521b7ff89
commit a08e64f37f
6 changed files with 85 additions and 45 deletions

View file

@ -271,11 +271,11 @@ pub fn len_16(x u16) int {
pub fn len_32(x u32) int {
mut y := x
mut n := 0
if y >= 1<<16 {
if y >= (1<<16) {
y >>= 16
n = 16
}
if y >= 1<<8 {
if y >= (1<<8) {
y >>= 8
n += 8
}