macro: move DECIMAL_STR_WIDTH() into macro.h
So that it sets next to DECIMAL_STR_MAX(), where it belongs.
This commit is contained in:
parent
8f328d36c9
commit
0d1dbeb3a4
|
@ -362,6 +362,15 @@ do { \
|
|||
sizeof(type) <= 4 ? 10 : \
|
||||
sizeof(type) <= 8 ? 20 : sizeof(int[-2*(sizeof(type) > 8)])))
|
||||
|
||||
#define DECIMAL_STR_WIDTH(x) \
|
||||
({ \
|
||||
typeof(x) _x_ = (x); \
|
||||
unsigned ans = 1; \
|
||||
while (_x_ /= 10) \
|
||||
ans++; \
|
||||
ans; \
|
||||
})
|
||||
|
||||
#define SET_FLAG(v, flag, b) \
|
||||
(v) = (b) ? ((v) | (flag)) : ((v) & ~(flag))
|
||||
|
||||
|
|
|
@ -237,15 +237,6 @@ static inline unsigned log2u_round_up(unsigned x) {
|
|||
return log2u(x - 1) + 1;
|
||||
}
|
||||
|
||||
#define DECIMAL_STR_WIDTH(x) \
|
||||
({ \
|
||||
typeof(x) _x_ = (x); \
|
||||
unsigned ans = 1; \
|
||||
while (_x_ /= 10) \
|
||||
ans++; \
|
||||
ans; \
|
||||
})
|
||||
|
||||
#define alloca0(n) \
|
||||
({ \
|
||||
char *_new_; \
|
||||
|
|
Loading…
Reference in a new issue