While implementing a new feature, I just found out that the function __count_leading_zeros_varying_i64 in generic.ispc internally store the result into a 32-bit integer variable while the function returns a 64-bit type. Do you agree? If so, should the function return a 32-bit int or the result be a 64-bit one? Considering the function in the doc, I would say that this is the former (32-bit return type).
The same thing likely also applies on __count_trailing_zeros_varying_i64 and the uniform versions (__count_trailing_zeros_uniform_i64 and __count_leading_zeros_uniform_i64). What about using an explicit cast like in __popcnt_xxx?
Besides, in the documentation, the output type is not clear for 64-bit types since it is not explicitly reported:
A few functions determine how many leading bits in the given value are zero and how many of the trailing bits are zero;
there are also unsigned variants of these functions and variants that take int64 and unsigned int64 types.
int32 count_leading_zeros(int32 v)
uniform int32 count_leading_zeros(uniform int32 v)
int32 count_trailing_zeros(int32 v)
uniform int32 count_trailing_zeros(uniform int32 v)
While implementing a new feature, I just found out that the function
__count_leading_zeros_varying_i64ingeneric.ispcinternally store the result into a 32-bit integer variable while the function returns a 64-bit type. Do you agree? If so, should the function return a 32-bit int or the result be a 64-bit one? Considering the function in the doc, I would say that this is the former (32-bit return type).The same thing likely also applies on
__count_trailing_zeros_varying_i64and the uniform versions (__count_trailing_zeros_uniform_i64and__count_leading_zeros_uniform_i64). What about using an explicit cast like in__popcnt_xxx?Besides, in the documentation, the output type is not clear for 64-bit types since it is not explicitly reported: