I wanted to test the following code
fn GetBit(value: u32, bitNumber: u32) u1 {
return (value & (1 << bitNumber)) > 0;
}
test "simple test" {
const minJ: u32 = 1;
const maxJ: u32 = 5;
for (minJ..maxJ) |j| {
GetBit(j, 1);
}
}
```
This code gives a compile error due to the fact that the j variable is of type usize. I need the types to be this specific because I will update them later to compile type generated integer types that are going to be bigger then 64 bits .
My question are:
- why does this code always return usize as type?
- How would I implement such a loop otherwise?
I hope this is clear enough for everyone to understand as It is my first time working in a systems language?