#Question about max number size

1 messages · Page 1 of 1 (latest)

paper forge
#

I tried to make a number that was a u65535 and it caused the following compiler error:

zig/lib/std/fmt.zig:1426:17: error: overflow of integer type 'u16' with value '65536'
    var buf: [1 + math.max(value_info.bits, 1)]u8 = undefined;

My question is why is buf adding 1 to the bit size?

summer wing
#

account for potential sign