mirror of https://github.com/pvnis/srsRAN_4G.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
550 B
C
31 lines
550 B
C
11 years ago
|
/*
|
||
|
* Copyright 2004, Phil Karn, KA9Q
|
||
10 years ago
|
* May be used under the terms of the GNU Affero General Public License (LGPL)
|
||
11 years ago
|
*/
|
||
|
|
||
|
#include <stdio.h>
|
||
10 years ago
|
#include <stdint.h>
|
||
11 years ago
|
|
||
10 years ago
|
uint8_t Partab[256];
|
||
|
uint32_t P_init;
|
||
11 years ago
|
|
||
|
/* Create 256-entry odd-parity lookup table
|
||
|
* Needed only on non-ia32 machines
|
||
|
*/
|
||
|
void partab_init(void) {
|
||
10 years ago
|
uint32_t i, cnt, ti;
|
||
11 years ago
|
|
||
10 years ago
|
/* Initialize parity lookup table */
|
||
|
for (i = 0; i < 256; i++) {
|
||
|
cnt = 0;
|
||
|
ti = i;
|
||
|
while (ti) {
|
||
|
if (ti & 1)
|
||
|
cnt++;
|
||
|
ti >>= 1;
|
||
|
}
|
||
|
Partab[i] = cnt & 1;
|
||
|
}
|
||
|
P_init = 1;
|
||
11 years ago
|
}
|