fun_ofdm
1.0
802.11a Physical Layer for USRP
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Enumerations
Enumerator
Macros
Pages
parity.h
Go to the documentation of this file.
1
7
#ifndef PARITY_H
8
#define PARITY_H
9
10
namespace
fun
11
{
12
17
/* Determine parity of argument: 1 = odd, 0 = even */
18
#ifdef __i386__
19
static
inline
int
parityb
(
unsigned
char
x){
20
__asm__ __volatile__ (
"test %1,%1;setpo %0"
:
"=g"
(x) :
"r"
(x));
21
return
x;
22
}
23
#else
24
25
#if __cplusplus
26
extern
"C"
{
27
#endif
28
void
partab_init
();
29
#if __cplusplus
30
};
31
#endif
32
33
static
inline
int
parityb
(
unsigned
char
x){
34
extern
unsigned
char
Partab
[256];
35
extern
int
Parity_initialized
;
36
if
(!Parity_initialized){
37
partab_init
();
38
}
39
return
Partab[x];
40
}
41
#endif
42
43
static
inline
int
parity
(
int
x){
44
/* Fold down to one byte */
45
x ^= (x >> 16);
46
x ^= (x >> 8);
47
return
parityb
(x);
48
}
49
}
50
51
52
#endif // PARITY_H
src
parity.h
Generated on Mon Oct 20 2014 10:26:27 for fun_ofdm by
1.8.4