Ivan Kluchnikov | 962f97b | 2012-04-30 17:51:23 +0400 | [diff] [blame] | 1 | /* bitvector.h |
| 2 | * |
| 3 | * Copyright (C) 2012 Ivan Klyuchnikov |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU General Public License |
| 7 | * as published by the Free Software Foundation; either version 2 |
| 8 | * of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 18 | */ |
| 19 | |
| 20 | #ifndef BITVECTOR_H |
| 21 | #define BITVECTOR_H |
| 22 | |
| 23 | /*! \defgroup bitvector Bit vectors |
| 24 | * @{ |
| 25 | */ |
| 26 | |
| 27 | /*! \file bitvector.h |
| 28 | * \brief Additional functions for Osmocom bit vector abstraction. |
| 29 | */ |
| 30 | |
| 31 | extern "C" { |
| 32 | #include <osmocom/core/bitvec.h> |
| 33 | } |
| 34 | |
| 35 | struct bitvec *bitvec_alloc(unsigned size); |
| 36 | void bitvec_free(struct bitvec *bv); |
| 37 | int bitvec_unhex(struct bitvec *bv, const char* src); |
Holger Hans Peter Freyther | 939bfae | 2013-07-28 16:04:35 +0200 | [diff] [blame] | 38 | unsigned int bitvec_pack(struct bitvec *bv, uint8_t *buffer); |
| 39 | unsigned int bitvec_unpack(struct bitvec *bv, uint8_t *buffer); |
Ivan Kluchnikov | 962f97b | 2012-04-30 17:51:23 +0400 | [diff] [blame] | 40 | uint64_t bitvec_read_field(struct bitvec *bv, unsigned& read_index, unsigned len); |
| 41 | int bitvec_write_field(struct bitvec *bv, unsigned& write_index, uint64_t val, unsigned len); |
Jacob Erlbeck | 4e7424d | 2016-02-01 13:26:22 +0100 | [diff] [blame] | 42 | int bitvec_write_field_lh(struct bitvec *bv, unsigned& write_index, uint64_t val, unsigned len); |
Ivan Kluchnikov | 962f97b | 2012-04-30 17:51:23 +0400 | [diff] [blame] | 43 | |
| 44 | /*! }@ */ |
| 45 | |
| 46 | #endif // BITVECTOR_H |