rename a_pid_fuzzy_equ to a_fuzzy_equ
[liba.git] / include / a / operator.h
blob9b85f7700a20b1ac7c8c8870713fbbeb044a4159
1 /*!
2 @file operator.h
3 @brief algorithm library operators
4 */
6 #ifndef LIBA_OPERATOR_H
7 #define LIBA_OPERATOR_H
9 /*!
10 @ingroup A
11 @addtogroup A_OPERATOR algorithm library operators
15 // clang-format off
17 #define a_inc(x) (++(x)) //!< prefix increment
18 #define a_dec(x) (--(x)) //!< prefix decrement
20 #define a_pos(x) (+(x)) //!< positive
21 #define a_neg(x) (-(x)) //!< negative
23 #define a_not(x) (!(x)) //!< logical NOT
24 #define a_compl(x) (~(x)) //!< bitwise NOT
26 #define a_mul(a, b) ((a) * (b)) //!< multiplication
27 #define a_div(a, b) ((a) / (b)) //!< division
28 #define a_mod(a, b) ((a) % (b)) //!< remainder
30 #define a_add(a, b) ((a) + (b)) //!< addition
31 #define a_sub(a, b) ((a) - (b)) //!< subtraction
33 #define a_lshift(a, b) ((a) << (b)) //!< bitwise left shift
34 #define a_rshift(a, b) ((a) >> (b)) //!< bitwise right shift
36 #define a_eq(a, b) ((a) == (b)) //!< equal to
37 #define a_ne(a, b) ((a) != (b)) //!< not equal to
38 #define a_lt(a, b) ((a) < (b)) //!< less than
39 #define a_gt(a, b) ((a) > (b)) //!< greater than
40 #define a_le(a, b) ((a) <= (b)) //!< less than or equal to
41 #define a_ge(a, b) ((a) >= (b)) //!< greater than or equal to
43 #define a_bitand(a, b) ((a) & (b)) //!< bitwise AND
44 #define a_bitxor(a, b) ((a) ^ (b)) //!< bitwise XOR (exclusive or)
45 #define a_bitor(a, b) ((a) | (b)) //!< bitwise OR (inclusive or)
47 #define a_and(a, b) ((a) && (b)) //!< logical AND
48 #define a_or(a, b) ((a) || (b)) //!< logical OR
50 #define a_add_eq(a, b) ((a) += (b)) //!< in-place assignment by sum
51 #define a_sub_eq(a, b) ((a) -= (b)) //!< in-place assignment by difference
52 #define a_mul_eq(a, b) ((a) *= (b)) //!< in-place assignment by product
53 #define a_div_eq(a, b) ((a) /= (b)) //!< in-place assignment by quotient
54 #define a_mod_eq(a, b) ((a) %= (b)) //!< in-place assignment by remainder
56 #define a_shl_eq(a, b) ((a) <<= (b)) //!< in-place assignment by bitwise left shift
57 #define a_shr_eq(a, b) ((a) >>= (b)) //!< in-place assignment by bitwise right shift
59 #define a_and_eq(a, b) ((a) &= (b)) //!< in-place assignment by bitwise AND
60 #define a_xor_eq(a, b) ((a) ^= (b)) //!< in-place assignment by bitwise XOR (exclusive or)
61 #define a_or_eq(a, b) ((a) |= (b)) //!< in-place assignment by bitwise OR (inclusive or)
63 // clang-format on
65 /*! @} A_OPERATOR */
67 #endif /* a/operator.h */