File tree 1 file changed +7
-7
lines changed
1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -39,16 +39,16 @@ static inline int color2int(Color c)
39
39
return rgb2int (c.r , c.g , c.b , c.a );
40
40
}
41
41
42
- // rounds n (upwards ) to a multiple of f while preserving the sign-bit of n
42
+ // rounds n (away from 0 ) to a multiple of f while preserving the sign of n
43
43
static inline int round_multiple_nosign (int n, int f)
44
44
{
45
- int nn, ns ;
46
- nn = (n >= 0 ) ? n : -n;
47
- ns = (n >= 0 ) ? 1 : -1 ;
48
- if (nn % f == 0 )
49
- return n; // n == nn * ns
45
+ int abs_n, sign ;
46
+ abs_n = (n >= 0 ) ? n : -n;
47
+ sign = (n >= 0 ) ? 1 : -1 ;
48
+ if (abs_n % f == 0 )
49
+ return n; // n == abs_n * sign
50
50
else
51
- return ns * (n + f - (n % f));
51
+ return sign * (abs_n + f - (abs_n % f));
52
52
}
53
53
54
54
static inline int readBlockContent (const unsigned char *mapData, int version, int datapos)
You can’t perform that action at this time.
1 commit comments
Zeno- commentedon Sep 2, 2014
Coulda thanked me :p