1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 16:52:14 +02:00

usb: common: Use a global definition for 'min3'

We can use a common global method for calculating minimum of
3 numbers. Put the same in 'common header' and let 'ehci'
use it.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Acked-by: Tom Rini <trini@ti.com>
This commit is contained in:
Vivek Gautam
2013-04-24 02:50:13 +00:00
committed by Marek Vasut
parent 55f4b57542
commit 4f4eab4d14
2 changed files with 21 additions and 14 deletions

View File

@@ -199,18 +199,35 @@ typedef void (interrupt_handler_t)(void *);
* General Purpose Utilities
*/
#define min(X, Y) \
({ typeof (X) __x = (X); \
typeof (Y) __y = (Y); \
({ typeof(X) __x = (X); \
typeof(Y) __y = (Y); \
(__x < __y) ? __x : __y; })
#define max(X, Y) \
({ typeof (X) __x = (X); \
typeof (Y) __y = (Y); \
({ typeof(X) __x = (X); \
typeof(Y) __y = (Y); \
(__x > __y) ? __x : __y; })
#define MIN(x, y) min(x, y)
#define MAX(x, y) max(x, y)
#define min3(X, Y, Z) \
({ typeof(X) __x = (X); \
typeof(Y) __y = (Y); \
typeof(Z) __z = (Z); \
__x < __y ? (__x < __z ? __x : __z) : \
(__y < __z ? __y : __z); })
#define max3(X, Y, Z) \
({ typeof(X) __x = (X); \
typeof(Y) __y = (Y); \
typeof(Z) __z = (Z); \
__x > __y ? (__x > __z ? __x : __z) : \
(__y > __z ? __y : __z); })
#define MIN3(x, y, z) min3(x, y, z)
#define MAX3(x, y, z) max3(x, y, z)
/*
* Return the absolute value of a number.
*