1.优化swap函数。

This commit is contained in:
MacRsh
2023-12-03 02:17:21 +08:00
parent 48e8317c66
commit 43e6393241

View File

@@ -133,7 +133,7 @@ extern "C" {
* @param a The first value. * @param a The first value.
* @param b The second value. * @param b The second value.
*/ */
#define mr_swap(a, b) (a ^= b, b ^= a, a ^= b) #define mr_swap(a, b) do { typeof(a) temp = a; a = b; b = temp; } while (0)
/** /**
* @brief This macro function aligns the size up to a multiple of 4. * @brief This macro function aligns the size up to a multiple of 4.