Result Location Semantics

I have another example, where yes I’m technically doing a downcast, but only because for loops always produce usizes rather than values.

max_len: u6 = 9  // this actulaly comes from a function call, but the return type is u6
for (0..max_len) |i| {
    // I Have to do all these casts even though i _know_ i can never be greater than a u6
    const shift: u6 = @as(u6, BASE_SHIFT_VALUE * @as(u6, @truncate(i))) + @intFromBool(max_len == MAX_SIZE and i != 0);
    var byte: u8 = @truncate(bits >> shift);
    if (max_len - i != VarInt.MAX_SIZE) {
        byte &= VARINT_MASK;
    }
    const mask: u8 = if (i == 0) 0 else CONT_MASK;
    out[max_len - 1 - i] = byte | mask;
}