mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 19:03:15 +01:00
Pagers now set their own utcb explicitly via exchange_registers. exregs accepts calls from active pagers for this purpose only.
23 lines
517 B
C
23 lines
517 B
C
#ifndef __LIB_MATH_H__
|
|
#define __LIB_MATH_H__
|
|
|
|
#define min(x, y) (((x) < (y)) ? (x) : (y))
|
|
#define max(x, y) (((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,
|
|
unsigned long c, unsigned long d)
|
|
{
|
|
/*
|
|
* Below is the complement set (') of the intersection
|
|
* of 2 ranges, much simpler ;-)
|
|
*/
|
|
if (b <= c || a >= d)
|
|
return 0;
|
|
|
|
/* The rest is always intersecting */
|
|
return 1;
|
|
}
|
|
|
|
#endif /* __LIB_MATH_H__ */
|