Skip to content

Commit

Permalink
Add cautionary note about sat_mul()
Browse files Browse the repository at this point in the history
  • Loading branch information
sfan5 committed Aug 8, 2023
1 parent 7af222d commit e14f27f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions TileGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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--) {
Expand Down

0 comments on commit e14f27f

Please sign in to comment.