Cleanup and improvements (#194)
- Lots of changes for migrating C code to C++ - Improved `Lockable` in several ways like adding `withLock()` (+ tests) - Improved `Semaphore` a bit for improved readability, and also added some tests - Upgrade Linux machine in GitHub Actions so that we can compile with a newer GCC - Simplification of WiFi connection - Updated funding options - (and more)
This commit is contained in:
committed by
GitHub
parent
1bb1260ea0
commit
6c67845645
@@ -1,37 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
/** Find the largest value
|
||||
* @param[in] a first value to compare
|
||||
* @param[in] b second value to compare
|
||||
* @return the largest value of a and b
|
||||
*/
|
||||
#define TT_MAX(a, b) \
|
||||
({ \
|
||||
__typeof__(a) _a = (a); \
|
||||
__typeof__(b) _b = (b); \
|
||||
_a > _b ? _a : _b; \
|
||||
})
|
||||
|
||||
/** Find the smallest value
|
||||
* @param[in] a first value to compare
|
||||
* @param[in] b second value to compare
|
||||
* @return the smallest value of a and b
|
||||
*/
|
||||
#define TT_MIN(a, b) \
|
||||
({ \
|
||||
__typeof__(a) _a = (a); \
|
||||
__typeof__(b) _b = (b); \
|
||||
_a < _b ? _a : _b; \
|
||||
})
|
||||
|
||||
/** @return the absolute value of the input */
|
||||
#define TT_ABS(a) ({ (a) < 0 ? -(a) : (a); })
|
||||
|
||||
/** Clamp a value between a min and a max.
|
||||
* @param[in] x value to clamp
|
||||
* @param[in] upper upper bounds for x
|
||||
* @param[in] lower lower bounds for x
|
||||
*/
|
||||
#define TT_CLAMP(x, upper, lower) (TT_MIN(upper, TT_MAX(x, lower)))
|
||||
|
||||
#define TT_STRINGIFY(x) #x
|
||||
|
||||
Reference in New Issue
Block a user