mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 02:43:15 +01:00
min/max definitions converted to inline functions instead of macros
This commit is contained in:
@@ -1,8 +1,15 @@
|
||||
#ifndef __LIB_MATH_H__
|
||||
#define __LIB_MATH_H__
|
||||
|
||||
#define min(x, y) (((x) < (y)) ? (x) : (y))
|
||||
#define max(x, y) (((x) > (y)) ? (x) : (y))
|
||||
static inline int min(int x, int y)
|
||||
{
|
||||
return x < y ? x : y;
|
||||
}
|
||||
|
||||
static inline int max(int x, int y)
|
||||
{
|
||||
return x > y ? x : y;
|
||||
}
|
||||
|
||||
/* Tests if ranges a-b intersect with range c-d */
|
||||
static inline int set_intersection(unsigned long a, unsigned long b,
|
||||
|
||||
Reference in New Issue
Block a user