1 /* 2 * Interval header 3 * Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org> 4 * 5 * 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. 10 * 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. 15 * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 * 20 */ 21 22 typedef struct _snd_interval snd_interval_t; 23 24 #ifdef SND_INTERVAL_INLINE 25 #include "interval_inline.h" 26 #else 27 void snd_interval_any(snd_interval_t *i); 28 void snd_interval_none(snd_interval_t *i); 29 int snd_interval_setinteger(snd_interval_t *i); 30 int snd_interval_empty(const snd_interval_t *i); 31 int snd_interval_single(const snd_interval_t *i); 32 int snd_interval_value(const snd_interval_t *i); 33 void snd_interval_set_value(snd_interval_t *i, unsigned int val); 34 int snd_interval_min(const snd_interval_t *i); 35 int snd_interval_max(const snd_interval_t *i); 36 void snd_interval_set_minmax(snd_interval_t *i, unsigned int min, unsigned int max); 37 int snd_interval_test(const snd_interval_t *i, unsigned int val); 38 void snd_interval_copy(snd_interval_t *dst, const snd_interval_t *src); 39 void snd_interval_floor(snd_interval_t *i); 40 void snd_interval_unfloor(snd_interval_t *i); 41 int snd_interval_always_eq(const snd_interval_t *i1, const snd_interval_t *i2); 42 int snd_interval_never_eq(const snd_interval_t *i1, const snd_interval_t *i2); 43 #endif 44 45 /* make local functions really local */ 46 #define snd_interval_add snd1_interval_add 47 #define snd_interval_sub snd1_interval_sub 48 #define snd_interval_mul snd1_interval_mul 49 #define snd_interval_div snd1_interval_div 50 #define snd_interval_muldiv snd1_interval_muldiv 51 #define snd_interval_muldivk snd1_interval_muldivk 52 #define snd_interval_mulkdiv snd1_interval_mulkdiv 53 #define snd_interval_print snd1_interval_print 54 #define snd_interval_refine_min snd1_interval_refine_min 55 #define snd_interval_refine_max snd1_interval_refine_max 56 #define snd_interval_refine snd1_interval_refine 57 #define snd_interval_refine_first snd1_interval_refine_first 58 #define snd_interval_refine_last snd1_interval_refine_last 59 #define snd_interval_refine_set snd1_interval_refine_set 60 61 void snd_interval_add(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c); 62 void snd_interval_sub(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c); 63 void snd_interval_mul(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c); 64 void snd_interval_div(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c); 65 void snd_interval_muldiv(const snd_interval_t *a, const snd_interval_t *b, 66 const snd_interval_t *c, snd_interval_t *d); 67 void snd_interval_muldivk(const snd_interval_t *a, const snd_interval_t *b, 68 unsigned int k, snd_interval_t *c); 69 void snd_interval_mulkdiv(const snd_interval_t *a, unsigned int k, 70 const snd_interval_t *b, snd_interval_t *c); 71 void snd_interval_print(const snd_interval_t *i, snd_output_t *out); 72 int snd_interval_refine_min(snd_interval_t *i, unsigned int min, int openmin); 73 int snd_interval_refine_max(snd_interval_t *i, unsigned int max, int openmax); 74 int snd_interval_refine(snd_interval_t *i, const snd_interval_t *v); 75 int snd_interval_refine_first(snd_interval_t *i); 76 int snd_interval_refine_last(snd_interval_t *i); 77 int snd_interval_refine_set(snd_interval_t *i, unsigned int val); 78 void boundary_sub(int a, int adir, int b, int bdir, int *c, int *cdir); 79 int boundary_lt(unsigned int a, int adir, unsigned int b, int bdir); 80 int boundary_nearer(int min, int mindir, int best, int bestdir, int max, int maxdir); 81