bladeRF/host/common/include/minmax.h
Jon Szymaniak 3ad30c3b5a libbladeRF: Windows build fix for test_sync program
Build error results from treating warnings as errors, with possible overflow in 64 -> 32bit conversion.
2014-03-08 19:55:22 -05:00

50 lines
872 B
C

/**
* @file minmax.h
*
* @brief These static inline routines are preferred over the use of macros,
* as they provide type safety.
*/
#ifndef MINMAX_H__
#define MINMAX_H__
#include <stdlib.h>
#include <stdint.h>
#include "host_config.h"
static inline size_t min_sz(size_t x, size_t y)
{
return x < y ? x : y;
}
static inline size_t max_sz(size_t x, size_t y)
{
return x > y ? x : y;
}
static inline unsigned int uint_min(unsigned int x, unsigned int y)
{
return x < y ? x : y;
}
static inline unsigned int uint_max(unsigned int x, unsigned int y)
{
return x > y ? x : y;
}
static inline uint32_t u32_min(uint32_t x, uint32_t y)
{
return x < y ? x : y;
}
static inline uint32_t u32_max(uint32_t x, uint32_t y)
{
return x > y ? x : y;
}
static inline uint64_t u64_min(uint64_t x, uint64_t y)
{
return x < y ? x : y;
}
#endif