Add cautionary note about sat_mul()

This commit is contained in:
sfan5 2023-08-08 14:18:26 +02:00
parent 7af222dd9d
commit e14f27f412
1 changed files with 2 additions and 0 deletions

View File

@ -43,6 +43,8 @@ inline T sat_mul(T a, T b)
return std::numeric_limits<T>::max();
return res;
#else
// WARNING: the fallback implementation is incorrect since we compute ceil(log(x)) not log(x)
// but that's good enough for our usecase...
const int bits = sizeof(T) * 8;
int hb_a = 0, hb_b = 0;
for (int i = bits - 1; i >= 0; i--) {