mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-11-29 18:48:09 +08:00
improve tk_swap
This commit is contained in:
parent
dcc82626a3
commit
75e2e034a4
@ -1,5 +1,8 @@
|
||||
# 最新动态
|
||||
|
||||
2024/10/24
|
||||
* tk_swap防止临时变量重名(感谢兆坤提供补丁)
|
||||
|
||||
2024/10/23
|
||||
* 修复mingw编译下font_stb_get_vmetrics异常问题(感谢颖健提供补丁)
|
||||
* 增加tk_sha256_hash_from_str(感谢兆坤提供补丁)
|
||||
|
@ -407,11 +407,12 @@ typedef enum _ret_t {
|
||||
#define tk_roundi(a) (int32_t)(((a) >= 0) ? ((a) + 0.5f) : ((a)-0.5f))
|
||||
#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; \
|
||||
#define tk_swap(a, b, type) \
|
||||
do { \
|
||||
ENSURE(!tk_str_eq("_tEMP__", #a) && !tk_str_eq("_tEMP__", #b)); \
|
||||
type _tEMP__ = a; \
|
||||
a = b; \
|
||||
b = _tEMP__; \
|
||||
} while (0)
|
||||
|
||||
#ifndef ARRAY_SIZE
|
||||
|
Loading…
Reference in New Issue
Block a user