ringbuffer.h (1472B)
1 /* 2 * libdivecomputer 3 * 4 * Copyright (C) 2008 Jef Driesen 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 11 * This library 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 GNU 14 * 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, 19 * MA 02110-1301 USA 20 */ 21 22 #ifndef RINGBUFFER_H 23 #define RINGBUFFER_H 24 25 #ifdef __cplusplus 26 extern "C" { 27 #endif /* __cplusplus */ 28 29 #define DC_RINGBUFFER_EMPTY 0 30 #define DC_RINGBUFFER_FULL 1 31 32 unsigned int 33 ringbuffer_normalize (unsigned int a, unsigned int begin, unsigned int end); 34 35 unsigned int 36 ringbuffer_distance (unsigned int a, unsigned int b, int mode, unsigned int begin, unsigned int end); 37 38 unsigned int 39 ringbuffer_increment (unsigned int a, unsigned int delta, unsigned int begin, unsigned int end); 40 41 unsigned int 42 ringbuffer_decrement (unsigned int a, unsigned int delta, unsigned int begin, unsigned int end); 43 44 #ifdef __cplusplus 45 } 46 #endif /* __cplusplus */ 47 #endif /* RINGBUFFER_H */