Closed jnohlgard closed 6 years ago
Hi,
Thanks for reporting!
Using libdivide on avr results in the following compile time warning/error:
Do you have a little more information about the avr CPU architecture you are using?
cmake .; make test
)?Honestly I have never used a CPU architecture that is neither 32 or 64-bit and so I have not tested libdivide on such a CPU architecture.
That's why I am curious if libdivide passes its test suite on avr.
static uint64_t libdivide_128_div_64_to_64()
{
// ...
int s;
s = libdivide__count_leading_zeros64(v);
// ...
un64 = (u1 << s) | ((u0 >> (64 - s)) & (-s >> 31));
}
The code clearly assumes that the type of s
is signed 32-bit as the return type of libdivide__count_leading_zeros64()
is int32_t
. Hence I am in favour of just changing the type of s
from int
to int32_t
instead of your cast.
Using libdivide on avr results in the following compile time warning/error:
I think this change is the correct cast to get the right behaviour on platforms where int is < 32 bits.