summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
c0b69b9)
Signed-off-by: Jens Axboe <axboe@fb.com>
+#ifndef FIO_FIFO_H
+#define FIO_FIFO_H
/*
* A simple FIFO implementation.
*
/*
* A simple FIFO implementation.
*
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
struct fifo {
unsigned char *buffer; /* the buffer holding the data */
unsigned int size; /* the size of the allocated buffer */
struct fifo {
unsigned char *buffer; /* the buffer holding the data */
unsigned int size; /* the size of the allocated buffer */
return fifo->size - fifo->in + fifo->out;
}
return fifo->size - fifo->in + fifo->out;
}
-#ifndef min
-#define min(x,y) ({ \
- typeof(x) _x = (x); \
- typeof(y) _y = (y); \
- (void) (&_x == &_y); \
- _x < _y ? _x : _y; })
-#endif
-
-#ifndef max
-#define max(x,y) ({ \
- typeof(x) _x = (x); \
- typeof(y) _y = (y); \
- (void) (&_x == &_y); \
- _x > _y ? _x : _y; })
-
#define FIO_MIN_MAX_H
#ifndef min
#define FIO_MIN_MAX_H
#ifndef min
-#define min(a, b) ((a) < (b) ? (a) : (b))
+#define min(x,y) ({ \
+ typeof(x) _x = (x); \
+ typeof(y) _y = (y); \
+ (void) (&_x == &_y); \
+ _x < _y ? _x : _y; })
-#define max(a, b) ((a) > (b) ? (a) : (b))
+#define max(x,y) ({ \
+ typeof(x) _x = (x); \
+ typeof(y) _y = (y); \
+ (void) (&_x == &_y); \
+ _x > _y ? _x : _y; })