mirror of
https://github.com/minetest/minetestmapper.git
synced 2024-11-23 07:53:47 +01:00
Add cautionary note about sat_mul()
This commit is contained in:
parent
7af222dd9d
commit
e14f27f412
@ -43,6 +43,8 @@ inline T sat_mul(T a, T b)
|
|||||||
return std::numeric_limits<T>::max();
|
return std::numeric_limits<T>::max();
|
||||||
return res;
|
return res;
|
||||||
#else
|
#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;
|
const int bits = sizeof(T) * 8;
|
||||||
int hb_a = 0, hb_b = 0;
|
int hb_a = 0, hb_b = 0;
|
||||||
for (int i = bits - 1; i >= 0; i--) {
|
for (int i = bits - 1; i >= 0; i--) {
|
||||||
|
Loading…
Reference in New Issue
Block a user