I try to compare two int64 scalar fields and I got this

`RuntimeError: [type_check.cpp:visit@46]`

if` conditions must be of type int32, consider using 'if x != 0:' instead of 'if x:' for float values.`

Is there something wrong with my code?

I try to compare two int64 scalar fields and I got this

`RuntimeError: [type_check.cpp:visit@46]`

if` conditions must be of type int32, consider using 'if x != 0:' instead of 'if x:' for float values.`

Is there something wrong with my code?

Hi, does using `if ti.cast(x != 0, ti.i32):`

work for you?

(It seems Taichi have considered the return value of `i64 == i64`

as `i64`

, but `if`

statement only supports `i32`

)

Thank you archibate, I have tried just now but it didnâ€™t work. It still report the same issue.

I wonder is there a function in taichi which can return the sub bits in a field ? It looks like this:

```
i64_tensor = ti.field(dtype=ti.i64,shape=(1,2))
i32_tensor = ti.somefunction(i64_tensor,[0,31])//returns the first 32bit interger field whose shape is the same as i64_tensor
i32_tensor = ti.somefunction(i64_tensor,[32,64])//returns the last 32bit interger field whose shape is the same as i64_tensor
```

But I think this operation may have a bad effect on taichi performance due to the discontinuity access to the memory