4272N/A * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. 4272N/A * Use is subject to license terms. 4272N/A * This library is free software; you can redistribute it and/or 4272N/A * modify it under the terms of the GNU Lesser General Public 4272N/A * License as published by the Free Software Foundation; either 4272N/A * version 2.1 of the License, or (at your option) any later version. 4272N/A * This library is distributed in the hope that it will be useful, 4272N/A * but WITHOUT ANY WARRANTY; without even the implied warranty of 4272N/A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 4272N/A * Lesser General Public License for more details. 4272N/A * You should have received a copy of the GNU Lesser General Public License 4272N/A * along with this library; if not, write to the Free Software Foundation, 4272N/A * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 4272N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 4272N/A/* ********************************************************************* 1674N/A * The Original Code is the MPI Arbitrary Precision Integer Arithmetic library. 1674N/A * The Initial Developer of the Original Code is 1674N/A * Portions created by the Initial Developer are Copyright (C) 1998 1674N/A * the Initial Developer. All Rights Reserved. 1674N/A *********************************************************************** */ 4272N/A/* Bitwise logical operations on MPI values */ 1674N/A/* {{{ Lookup table for population count */ 1674N/A 0,
1,
1,
2,
1,
2,
2,
3,
1,
2,
2,
3,
2,
3,
3,
4,
1674N/A 1,
2,
2,
3,
2,
3,
3,
4,
2,
3,
3,
4,
3,
4,
4,
5,
1674N/A 1,
2,
2,
3,
2,
3,
3,
4,
2,
3,
3,
4,
3,
4,
4,
5,
1674N/A 2,
3,
3,
4,
3,
4,
4,
5,
3,
4,
4,
5,
4,
5,
5,
6,
1674N/A 1,
2,
2,
3,
2,
3,
3,
4,
2,
3,
3,
4,
3,
4,
4,
5,
1674N/A 2,
3,
3,
4,
3,
4,
4,
5,
3,
4,
4,
5,
4,
5,
5,
6,
1674N/A 2,
3,
3,
4,
3,
4,
4,
5,
3,
4,
4,
5,
4,
5,
5,
6,
1674N/A 3,
4,
4,
5,
4,
5,
5,
6,
4,
5,
5,
6,
5,
6,
6,
7,
1674N/A 1,
2,
2,
3,
2,
3,
3,
4,
2,
3,
3,
4,
3,
4,
4,
5,
1674N/A 2,
3,
3,
4,
3,
4,
4,
5,
3,
4,
4,
5,
4,
5,
5,
6,
1674N/A 2,
3,
3,
4,
3,
4,
4,
5,
3,
4,
4,
5,
4,
5,
5,
6,
1674N/A 3,
4,
4,
5,
4,
5,
5,
6,
4,
5,
5,
6,
5,
6,
6,
7,
1674N/A 2,
3,
3,
4,
3,
4,
4,
5,
3,
4,
4,
5,
4,
5,
5,
6,
1674N/A 3,
4,
4,
5,
4,
5,
5,
6,
4,
5,
5,
6,
5,
6,
6,
7,
1674N/A 3,
4,
4,
5,
4,
5,
5,
6,
4,
5,
5,
6,
5,
6,
6,
7,
1674N/A 4,
5,
5,
6,
5,
6,
6,
7,
5,
6,
6,
7,
6,
7,
7,
8 1674N/A mpl_rsh(a, b, d) - b = a >> d 1674N/A mpl_lsh(a, b, d) - b = a << d 1674N/A/*------------------------------------------------------------------------*/ 1674N/A Returns MP_OKAY or some error code. 1674N/A Grows a if needed to set a bit to 1. 1674N/A returns 0 or 1 or some (negative) error code. 1674N/A - Extracts numBits bits from a, where the least significant extracted bit 1674N/A is bit lsbNum. Returns a negative value if error occurs. 1674N/A - Because sign bit is used to indicate error, maximum number of bits to 1674N/A be returned is the lesser of (a) the number of bits in an mp_digit, or 1674N/A (b) one less than the number of bits in an mp_err. 1674N/A - lsbNum + numbits can be greater than the number of significant bits in 1674N/A integer a, as long as bit lsbNum is in the high order digit of a. 1674N/A returns number of significnant bits in abs(a). 1674N/A returns 1 if value is zero. 1674N/A/*------------------------------------------------------------------------*/