Skip to content

Commit 649c8d4

Browse files
committed
Let compilers optimize the calls of abs
1 parent 9df01d3 commit 649c8d4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/m_fixed.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#define __M_FIXED__
3535

3636
#include <stdint.h>
37+
#include <stdlib.h>
3738

3839
#include "doomtype.h"
3940
#include "m_recip.h"
@@ -52,12 +53,17 @@ typedef int fixed_t;
5253
* Absolute Value
5354
*/
5455

56+
#if 0
5557
inline static int CONSTFUNC D_abs(fixed_t x)
5658
{
5759
fixed_t _t = (x), _s;
5860
_s = _t >> (8 * sizeof _t - 1);
5961
return (_t ^ _s) - _s;
6062
}
63+
#else
64+
/* let compilers optimize the calls of abs */
65+
#define D_abs abs
66+
#endif
6167

6268
/*
6369
* Fixed Point Multiplication

0 commit comments

Comments
 (0)