mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-01 22:58:49 -04:00
Little cleaning of interval code
This commit is contained in:
parent
9acdef38c9
commit
80c3adaace
2 changed files with 9 additions and 6 deletions
|
|
@ -107,8 +107,7 @@ int interval_refine_min(interval_t *i, unsigned int min)
|
||||||
i->openmin = 0;
|
i->openmin = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i->min > i->max ||
|
if (interval_checkempty(i)) {
|
||||||
(i->min == i->max && (i->openmin || i->openmax))) {
|
|
||||||
i->empty = 1;
|
i->empty = 1;
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
@ -135,8 +134,7 @@ int interval_refine_max(interval_t *i, unsigned int max)
|
||||||
i->openmax = 0;
|
i->openmax = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i->min > i->max ||
|
if (interval_checkempty(i)) {
|
||||||
(i->min == i->max && (i->openmin || i->openmax))) {
|
|
||||||
i->empty = 1;
|
i->empty = 1;
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
@ -174,8 +172,7 @@ int interval_refine(interval_t *i, const interval_t *v)
|
||||||
i->openmax = 0;
|
i->openmax = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i->min > i->max ||
|
if (interval_checkempty(i)) {
|
||||||
(i->min == i->max && (i->openmin || i->openmax))) {
|
|
||||||
i->empty = 1;
|
i->empty = 1;
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,12 @@ INLINE void interval_all(interval_t *i)
|
||||||
i->max = UINT_MAX;
|
i->max = UINT_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
INLINE int interval_checkempty(const interval_t *i)
|
||||||
|
{
|
||||||
|
return (i->min > i->max ||
|
||||||
|
(i->min == i->max && (i->openmin || i->openmax)));
|
||||||
|
}
|
||||||
|
|
||||||
INLINE int interval_empty(const interval_t *i)
|
INLINE int interval_empty(const interval_t *i)
|
||||||
{
|
{
|
||||||
return i->empty;
|
return i->empty;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue