9
0
Fork 0

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:
Juergen Beisert 2010-12-20 16:05:00 +01:00 committed by Sascha Hauer
parent 50352ae9d9
commit 799b06606b
1 changed files with 10 additions and 0 deletions

View File

@ -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_ */