improve tk_swap

This commit is contained in:
lixianjing 2024-10-08 17:15:09 +08:00
parent 533dcd7551
commit ed0ddbcfa3
2 changed files with 3 additions and 2 deletions

View File

@ -3,6 +3,7 @@
2024/10/08
* 完善链表(感谢兆坤提供补丁)
* 修复 conf_json_parse (感谢兆坤提供补丁)
* 完善宏定义(感谢兆坤提供补丁)
2024/10/01
* 完善链表(感谢兆坤提供补丁)

View File

@ -408,11 +408,11 @@ typedef enum _ret_t {
#define tk_clamp(a, mn, mx) ((a) < (mn) ? (mn) : ((a) > (mx) ? (mx) : (a)))
#define tk_clampi(a, mn, mx) (int32_t)((a) < (mn) ? (mn) : ((a) > (mx) ? (mx) : (a)))
#define tk_swap(a, b, type) \
{ \
do { \
type temp = a; \
a = b; \
b = temp; \
}
} while (0)
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))