File: bitarray.h

package info (click to toggle)
batmand 0.3-3
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 528 kB
  • ctags: 720
  • sloc: ansic: 7,045; makefile: 124; sh: 40
file content (36 lines) | stat: -rw-r--r-- 1,403 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
 * Copyright (C) 2006 B.A.T.M.A.N. contributors:
 * Simon Wunderlich, Axel Neumann, Marek Lindner
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of version 2 of the GNU General Public
 * License as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301, USA
 *
 */



#define TYPE_OF_WORD unsigned long /* you should choose something big, if you don't want to waste cpu */
#define WORD_BIT_SIZE ( sizeof(TYPE_OF_WORD) * 8 )
#include "batman.h"



void bit_init( TYPE_OF_WORD *seq_bits );
uint8_t get_bit_status( TYPE_OF_WORD *seq_bits, uint16_t last_seqno, uint16_t curr_seqno );
char *bit_print( TYPE_OF_WORD *seq_bits );
void bit_mark( TYPE_OF_WORD *seq_bits, int32_t n );
void bit_shift( TYPE_OF_WORD *seq_bits, int32_t n );
char bit_get_packet( TYPE_OF_WORD *seq_bits, int16_t seq_num_diff, int8_t set_mark );
int  bit_packet_count( TYPE_OF_WORD *seq_bits );
uint8_t bit_count( int32_t to_count );