OLD | NEW |
1 /* | 1 /* |
| 2 * lfsr.c |
| 3 * |
| 4 */ |
| 5 |
| 6 /* |
2 * | 7 * |
3 * Copyright (c) 2001-2006, Cisco Systems, Inc. | 8 * Copyright (c) 2001-2006, Cisco Systems, Inc. |
4 * All rights reserved. | 9 * All rights reserved. |
5 * | 10 * |
6 * Redistribution and use in source and binary forms, with or without | 11 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 12 * modification, are permitted provided that the following conditions |
8 * are met: | 13 * are met: |
9 * | 14 * |
10 * Redistributions of source code must retain the above copyright | 15 * Redistributions of source code must retain the above copyright |
11 * notice, this list of conditions and the following disclaimer. | 16 * notice, this list of conditions and the following disclaimer. |
(...skipping 14 matching lines...) Expand all Loading... |
26 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | 31 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, |
27 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 32 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 33 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
29 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 34 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | 35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
31 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 36 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 37 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
33 * OF THE POSSIBILITY OF SUCH DAMAGE. | 38 * OF THE POSSIBILITY OF SUCH DAMAGE. |
34 * | 39 * |
35 */ | 40 */ |
36 /* | |
37 * lfsr.c | |
38 * | |
39 */ | |
40 | |
41 | 41 |
42 #include <stdio.h> | 42 #include <stdio.h> |
43 #include "datatypes.h" | 43 #include "datatypes.h" |
44 | 44 |
45 uint32_t | 45 uint32_t |
46 parity(uint32_t x) { | 46 parity(uint32_t x) { |
47 | 47 |
48 x ^= (x >> 16); | 48 x ^= (x >> 16); |
49 x ^= (x >> 8); | 49 x ^= (x >> 8); |
50 x ^= (x >> 4); | 50 x ^= (x >> 4); |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 | 336 |
337 /* print weight distribution */ | 337 /* print weight distribution */ |
338 for (j=0; j <= 8; j++) { | 338 for (j=0; j <= 8; j++) { |
339 printf("A[%d]: %d\n", j, A[j]); | 339 printf("A[%d]: %d\n", j, A[j]); |
340 } | 340 } |
341 } | 341 } |
342 } | 342 } |
343 | 343 |
344 return 0; | 344 return 0; |
345 } | 345 } |
OLD | NEW |