Go to the source code of this file.
◆ max_m
#define max_m |
( |
| NUM_A, |
|
|
| NUM_B ) |
Value:( ( NUM_A ) > ( NUM_B ) ? ( NUM_A ) : ( NUM_B ) )
Evaluates to the bigger of the two numbers. Works with both integral and floating-point types with some caveats (see below).
- Attention
- constructs with the ++, --, +=, -=, ... operators like
int a = 10, b = 10;
#define max_m(NUM_A, NUM_B)
Definition simple_math.h:63
are undefined for this macro.
This isn't the case for the (min|max)_[ui]64 functions
◆ min_m
#define min_m |
( |
| NUM_A, |
|
|
| NUM_B ) |
Value:( ( NUM_A ) < ( NUM_B ) ? ( NUM_A ) : ( NUM_B ) )
Evaluates to the smaller of the two numbers. Works with both integral and floating-point types with some caveats (see below).
- Attention
- constructs with the ++, --, +=, -=, ... operators like
int a = 10, b = 10;
#define min_m(NUM_A, NUM_B)
Definition simple_math.h:49
are undefined for this macro.
This isn't the case for the (min|max)_[ui]64 functions
◆ sign_flipped
#define sign_flipped |
( |
| SIGN | ) |
|
Value:- Returns
- 1 if sign was -1 and vice versa
- See also
- sign_t
◆ sign_t
The signs are equal to their supposed value.
Enumerator |
---|
SIGN_NEG | |
SIGN_POS | |
◆ is_power_of_two()
Returns true if num is a power of two.
◆ is_within()
Tests if num is within the specified bounds.
low should obviously be smaller than high
- Parameters
-
low | lower bound |
num | tested number |
high | upper bound |
- Returns
- true if low <= num <= high
◆ max_i64()
◆ max_u64()
◆ min_i64()
◆ min_u64()
◆ sgn_64()
Sign ( -1, 0, 1 ) of the number