OLD | NEW |
1 /* | 1 /* |
2 * mplogic.c | 2 * mplogic.c |
3 * | 3 * |
4 * Bitwise logical operations on MPI values | 4 * Bitwise logical operations on MPI values |
5 * | 5 * |
6 * This Source Code Form is subject to the terms of the Mozilla Public | 6 * This Source Code Form is subject to the terms of the Mozilla Public |
7 * License, v. 2.0. If a copy of the MPL was not distributed with this | 7 * License, v. 2.0. If a copy of the MPL was not distributed with this |
8 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 8 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
9 /* $Id$ */ | |
10 | 9 |
11 #include "mpi-priv.h" | 10 #include "mpi-priv.h" |
12 #include "mplogic.h" | 11 #include "mplogic.h" |
13 | 12 |
14 /* {{{ Lookup table for population count */ | 13 /* {{{ Lookup table for population count */ |
15 | 14 |
16 static unsigned char bitc[] = { | 15 static unsigned char bitc[] = { |
17 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, | 16 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, |
18 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, | 17 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, |
19 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, | 18 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 } | 423 } |
425 } | 424 } |
426 bits += ix * MP_DIGIT_BIT; | 425 bits += ix * MP_DIGIT_BIT; |
427 if (!bits) | 426 if (!bits) |
428 bits = 1; | 427 bits = 1; |
429 return bits; | 428 return bits; |
430 } | 429 } |
431 | 430 |
432 /*------------------------------------------------------------------------*/ | 431 /*------------------------------------------------------------------------*/ |
433 /* HERE THERE BE DRAGONS */ | 432 /* HERE THERE BE DRAGONS */ |
OLD | NEW |