Revision 33ed69afda68debb188f87dcbccfc2094105e451 authored by Pierrick Gaudry on 22 November 2010, 12:39:23 UTC, committed by Pierrick Gaudry on 22 November 2010, 12:39:23 UTC
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/cado-nfs/trunk@416 3eaf19af-ecc0-40f6-b43f-672aa0c71c71
1 parent 8ef5659
Raw File
mul6k_c.c
/* This file is part of the gf2x library.

   Copyright 2007, 2008, 2009, 2010
   Richard Brent, Pierrick Gaudry, Emmanuel Thome', Paul Zimmermann

   This program is free software; you can redistribute it and/or modify it
   under the terms of the GNU Lesser General Public License as published by
   the Free Software Foundation; either version 2.1 of the License, or (at
   your option) any later version.
   
   This program is distributed in the hope that it will be useful, but WITHOUT
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
   License for more details.
   
   You should have received a copy of the GNU Lesser General Public
   License along with CADO-NFS; see the file COPYING.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/
#ifndef GF2X_MUL6_H_
#define GF2X_MUL6_H_

#include "gf2x.h"
/* All gf2x source files for lowlevel functions must include gf2x-small.h
 * This is mandatory for the tuning mechanism. */
#include "gf2x/gf2x-small.h"

    GF2X_STORAGE_CLASS_mul6
void gf2x_mul6 (unsigned long *c, const unsigned long *a, const unsigned long *b)
{
  unsigned long aa[6], bb[6];
  unsigned long p0[4], p1[4], p2[4];
  unsigned long pp0[4], pp1[4], pp2[4];
  aa[0] = a[2]^a[4];
  aa[1] = a[3]^a[5];
  aa[2] = a[0]^a[4];
  aa[3] = a[1]^a[5];
  aa[4] = a[0]^a[2];
  aa[5] = a[1]^a[3];
  bb[0] = b[2]^b[4];
  bb[1] = b[3]^b[5];
  bb[2] = b[0]^b[4];
  bb[3] = b[1]^b[5];
  bb[4] = b[0]^b[2];
  bb[5] = b[1]^b[3];
  gf2x_mul2 (p0, a, b);
  gf2x_mul2 (p1, a+2, b+2);
  gf2x_mul2 (p2, a+4, b+4);
  gf2x_mul2 (pp0, aa, bb);
  gf2x_mul2 (pp1, aa+2, bb+2);
  gf2x_mul2 (pp2, aa+4, bb+4);
  c[0]  = p0[0];
  c[1]  = p0[1];
  c[2]  = p0[0]^p1[0]^pp2[0]       ^ p0[2];
  c[3]  = p0[1]^p1[1]^pp2[1]       ^ p0[3];
  c[4]  = p0[0]^p1[0]^p2[0]^pp1[0] ^ p0[2]^p1[2]^pp2[2];
  c[5]  = p0[1]^p1[1]^p2[1]^pp1[1] ^ p0[3]^p1[3]^pp2[3];
  c[6]  = pp0[0]^p1[0]^p2[0]       ^ p0[2]^p1[2]^p2[2]^pp1[2];
  c[7]  = pp0[1]^p1[1]^p2[1]       ^ p0[3]^p1[3]^p2[3]^pp1[3];
  c[8]  = p2[0]                    ^ pp0[2]^p1[2]^p2[2];
  c[9]  = p2[1]                    ^ pp0[3]^p1[3]^p2[3];
  c[10] =                            p2[2];
  c[11] =                            p2[3];
}

#endif  /* GF2X_MUL6_H_ */
back to top