jdk/src/share/native/sun/security/ec/impl/mplogic.c

Print this page




  35  * Michael J. Fromberger.
  36  * Portions created by the Initial Developer are Copyright (C) 1998
  37  * the Initial Developer. All Rights Reserved.
  38  *
  39  * Contributor(s):
  40  *
  41  * Alternatively, the contents of this file may be used under the terms of
  42  * either the GNU General Public License Version 2 or later (the "GPL"), or
  43  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  44  * in which case the provisions of the GPL or the LGPL are applicable instead
  45  * of those above. If you wish to allow use of your version of this file only
  46  * under the terms of either the GPL or the LGPL, and not to allow others to
  47  * use your version of this file under the terms of the MPL, indicate your
  48  * decision by deleting the provisions above and replace them with the notice
  49  * and other provisions required by the GPL or the LGPL. If you do not delete
  50  * the provisions above, a recipient may use your version of this file under
  51  * the terms of any one of the MPL, the GPL or the LGPL.
  52  *
  53  *********************************************************************** */
  54 /*
  55  * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
  56  * Use is subject to license terms.
  57  */
  58 
  59 /* $Id: mplogic.c,v 1.15 2004/04/27 23:04:36 gerv%gerv.net Exp $ */
  60 
  61 #include "mpi-priv.h"
  62 #include "mplogic.h"
  63 
  64 /* {{{ Lookup table for population count */
  65 
  66 static unsigned char bitc[] = {
  67    0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
  68    1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
  69    1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
  70    2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
  71    1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
  72    2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
  73    2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
  74    3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
  75    1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,




  35  * Michael J. Fromberger.
  36  * Portions created by the Initial Developer are Copyright (C) 1998
  37  * the Initial Developer. All Rights Reserved.
  38  *
  39  * Contributor(s):
  40  *
  41  * Alternatively, the contents of this file may be used under the terms of
  42  * either the GNU General Public License Version 2 or later (the "GPL"), or
  43  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  44  * in which case the provisions of the GPL or the LGPL are applicable instead
  45  * of those above. If you wish to allow use of your version of this file only
  46  * under the terms of either the GPL or the LGPL, and not to allow others to
  47  * use your version of this file under the terms of the MPL, indicate your
  48  * decision by deleting the provisions above and replace them with the notice
  49  * and other provisions required by the GPL or the LGPL. If you do not delete
  50  * the provisions above, a recipient may use your version of this file under
  51  * the terms of any one of the MPL, the GPL or the LGPL.
  52  *
  53  *********************************************************************** */
  54 /*
  55  * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
  56  * Use is subject to license terms.
  57  */
  58 
  59 /* $Id: mplogic.c,v 1.15 2004/04/27 23:04:36 gerv%gerv.net Exp $ */
  60 
  61 #include "mpi-priv.h"
  62 #include "mplogic.h"
  63 
  64 /* {{{ Lookup table for population count */
  65 
  66 static unsigned char bitc[] = {
  67    0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
  68    1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
  69    1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
  70    2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
  71    1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
  72    2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
  73    2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
  74    3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
  75    1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,