• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/iserver/alsa-lib-1.0.26/src/pcm/

Lines Matching defs:*

2  *  Interval inlines
3 * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
6 * This library is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation; either version 2.1 of
9 * the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #define INTERVAL_INLINE static inline
24 INTERVAL_INLINE void snd_interval_any(snd_interval_t *i)
26 i->min = 0;
27 i->openmin = 0;
28 i->max = UINT_MAX;
29 i->openmax = 0;
30 i->integer = 0;
31 i->empty = 0;
34 INTERVAL_INLINE void snd_interval_none(snd_interval_t *i)
36 i->empty = 1;
39 INTERVAL_INLINE int snd_interval_checkempty(const snd_interval_t *i)
41 return (i->min > i->max ||
42 (i->min == i->max && (i->openmin || i->openmax)));
45 INTERVAL_INLINE int snd_interval_empty(const snd_interval_t *i)
47 return i->empty;
50 INTERVAL_INLINE int snd_interval_single(const snd_interval_t *i)
52 assert(!snd_interval_empty(i));
53 return (i->min == i->max ||
54 (i->min + 1 == i->max && i->openmax));
57 INTERVAL_INLINE int snd_interval_value(const snd_interval_t *i)
59 assert(snd_interval_single(i));
60 return i->min;
63 INTERVAL_INLINE void snd_interval_set_value(snd_interval_t *i, unsigned int val)
65 i->openmax = i->openmin = 0;
66 i->min = i->max = val;
67 i->integer = 0;
68 i->empty = 0;
71 INTERVAL_INLINE int snd_interval_min(const snd_interval_t *i)
73 assert(!snd_interval_empty(i));
74 return i->min;
77 INTERVAL_INLINE int snd_interval_max(const snd_interval_t *i)
79 assert(!snd_interval_empty(i));
80 return i->max;
83 INTERVAL_INLINE void snd_interval_set_minmax(snd_interval_t *i, unsigned int min, unsigned int max)
85 i->openmax = i->openmin = 0;
86 i->min = min;
87 i->max = max;
88 i->integer = 0;
89 i->empty = 0;
92 INTERVAL_INLINE int snd_interval_test(const snd_interval_t *i, unsigned int val)
94 return !((i->min > val || (i->min == val && i->openmin) ||
95 i->max < val || (i->max == val && i->openmax)));
98 INTERVAL_INLINE void snd_interval_copy(snd_interval_t *d, const snd_interval_t *s)
100 *d = *s;
103 INTERVAL_INLINE int snd_interval_setinteger(snd_interval_t *i)
105 if (i->integer)
106 return 0;
107 if (i->openmin && i->openmax && i->min == i->max)
108 return -EINVAL;
109 i->integer = 1;
110 return 1;
113 INTERVAL_INLINE void snd_interval_floor(snd_interval_t *i)
115 if (i->integer || snd_interval_empty(i))
116 return;
117 i->openmin = 0;
118 if (i->openmax) {
119 i->max--;
120 i->openmax = 0;
122 i->integer = 1;
125 INTERVAL_INLINE void snd_interval_unfloor(snd_interval_t *i)
127 if (snd_interval_empty(i))
128 return;
129 if (i->max == UINT_MAX)
130 return;
131 if (i->openmax)
132 return;
133 i->max++;
134 i->openmax = 1;
135 i->integer = 0;
139 INTERVAL_INLINE int snd_interval_always_eq(const snd_interval_t *i1, const snd_interval_t *i2)
141 return snd_interval_single(i1) && snd_interval_single(i2) &&
142 snd_interval_value(i1) == snd_interval_value(i2);
145 INTERVAL_INLINE int snd_interval_never_eq(const snd_interval_t *i1, const snd_interval_t *i2)
148 return (i1->max < i2->min ||
149 (i1->max == i2->min &&
150 (i1->openmax || i1->openmin)) ||
151 i1->min > i2->max ||
152 (i1->min == i2->max &&
153 (i1->openmin || i2->openmax)));