Add more useful generic macros
Stolen from the Linux kernel. Signed-off-by: Juergen Beisert <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
50352ae9d9
commit
799b06606b
|
@ -231,4 +231,14 @@ extern const char version_string[];
|
|||
} \
|
||||
)
|
||||
|
||||
#define abs(x) ({ \
|
||||
long __x = (x); \
|
||||
(__x < 0) ? -__x : __x; \
|
||||
})
|
||||
|
||||
#define abs64(x) ({ \
|
||||
s64 __x = (x); \
|
||||
(__x < 0) ? -__x : __x; \
|
||||
})
|
||||
|
||||
#endif /* __COMMON_H_ */
|
||||
|
|
Loading…
Reference in New Issue