Commit 3127a3cc9793051df630b3ce67b6628eea1078f9

Authored by KMG
2 parents f8ff1e2f 20a242d9
Exists in master and in 2 other branches v2, v3

Merged in dachary/gf-complete/wip-compilation-warnings (pull request #3)

fix compilation warnings
configure.ac
... ... @@ -17,8 +17,7 @@ AC_CONFIG_MACRO_DIR([m4])
17 17 AM_MAINTAINER_MODE([disable])
18 18  
19 19 # Override default CFLAGS
20   -CFLAGS="-O3 -g"
21   -CXXFLAGS="-O3 -g"
  20 +CFLAGS="-Wall -O3 -g"
22 21  
23 22 dnl Compiling with per-target flags requires AM_PROG_CC_C_O.
24 23 AC_PROG_CC
... ...
examples/gf_example_2.c
... ... @@ -28,8 +28,8 @@ int main(int argc, char **argv)
28 28 {
29 29 uint32_t a, b, c;
30 30 uint8_t *r1, *r2;
31   - uint16_t *r16;
32   - uint32_t *r32;
  31 + uint16_t *r16 = NULL;
  32 + uint32_t *r32 = NULL;
33 33 int w, i;
34 34 gf_t gf;
35 35  
... ...
examples/gf_example_5.c
... ... @@ -74,4 +74,5 @@ int main(int argc, char **argv)
74 74 gf.extract_word.w32(&gf, a, 30*2, i+15),
75 75 gf.extract_word.w32(&gf, b, 30*2, i+15));
76 76 }
  77 + return 0;
77 78 }
... ...
examples/gf_example_6.c
... ... @@ -80,4 +80,5 @@ int main(int argc, char **argv)
80 80 gf.extract_word.w32(&gf, a, 30*4, i+15),
81 81 gf.extract_word.w32(&gf, b, 30*4, i+15));
82 82 }
  83 + return 0;
83 84 }
... ...
examples/gf_example_7.c
... ... @@ -71,4 +71,5 @@ int main(int argc, char **argv)
71 71 gf.extract_word.w32(&gf, a, 3, i),
72 72 gf.extract_word.w32(&gf, b, 3, i));
73 73 }
  74 + return 0;
74 75 }
... ...
src/gf.c
... ... @@ -179,13 +179,11 @@ uint64_t gf_composite_get_default_poly(gf_t *base)
179 179 int gf_error_check(int w, int mult_type, int region_type, int divide_type,
180 180 int arg1, int arg2, uint64_t poly, gf_t *base)
181 181 {
182   - int sse4 = 0;
183 182 int sse3 = 0;
184 183 int sse2 = 0;
185 184 int pclmul = 0;
186 185 int rdouble, rquad, rlazy, rsse, rnosse, raltmap, rcauchy, tmp;
187   - uint64_t pp;
188   - gf_internal_t *sub, *subsub, *subsubsub;
  186 + gf_internal_t *sub;
189 187  
190 188 rdouble = (region_type & GF_REGION_DOUBLE_TABLE);
191 189 rquad = (region_type & GF_REGION_QUAD_TABLE);
... ... @@ -214,10 +212,6 @@ int gf_error_check(int w, int mult_type, int region_type, int divide_type,
214 212 sse3 = 1;
215 213 #endif
216 214  
217   -#ifdef INTEL_SSE4
218   - sse4 = 1;
219   -#endif
220   -
221 215 #ifdef INTEL_SSE4_PCLMUL
222 216 pclmul = 1;
223 217 #endif
... ... @@ -488,7 +482,7 @@ int gf_init_hard(gf_t *gf, int w, int mult_type,
488 482 h->arg2 = arg2;
489 483 h->base_gf = base_gf;
490 484 h->private = (void *) gf->scratch;
491   - h->private += (sizeof(gf_internal_t));
  485 + h->private = (char*)h->private + (sizeof(gf_internal_t));
492 486 gf->extract_word.w32 = NULL;
493 487  
494 488 switch(w) {
... ... @@ -525,7 +519,7 @@ void gf_alignment_error(char *s, int a)
525 519  
526 520 static
527 521 void gf_invert_binary_matrix(uint32_t *mat, uint32_t *inv, int rows) {
528   - int cols, i, j, k;
  522 + int cols, i, j;
529 523 uint32_t tmp;
530 524  
531 525 cols = rows;
... ... @@ -594,7 +588,7 @@ uint32_t gf_bitmatrix_inverse(uint32_t y, int w, uint32_t pp)
594 588 void gf_two_byte_region_table_multiply(gf_region_data *rd, uint16_t *base)
595 589 {
596 590 uint64_t a, prod;
597   - int j, xor;
  591 + int xor;
598 592 uint64_t *s64, *d64, *top;
599 593  
600 594 s64 = rd->s_start;
... ... @@ -693,8 +687,8 @@ static void gf_slow_multiply_region(gf_region_data *rd, void *src, void *dest, v
693 687 fprintf(stderr, "Error: gf_slow_multiply_region: w=%d not implemented.\n", h->w);
694 688 exit(1);
695 689 }
696   - src += wb;
697   - dest += wb;
  690 + src = (char*)src + wb;
  691 + dest = (char*)dest + wb;
698 692 }
699 693 }
700 694  
... ... @@ -773,8 +767,7 @@ void gf_set_region_data(gf_region_data *rd,
773 767 int xor,
774 768 int align)
775 769 {
776   - uint8_t *s8, *d8;
777   - gf_internal_t *h;
  770 + gf_internal_t *h = NULL;
778 771 int wb;
779 772 uint32_t a;
780 773 unsigned long uls, uld;
... ... @@ -802,7 +795,7 @@ void gf_set_region_data(gf_region_data *rd,
802 795  
803 796 if (align == -1) { /* JSP: This is cauchy. Error check bytes, then set up the pointers
804 797 so that there are no alignment regions. */
805   - if (bytes % h->w != 0) {
  798 + if (h != NULL && bytes % h->w != 0) {
806 799 fprintf(stderr, "Error in region multiply operation.\n");
807 800 fprintf(stderr, "The size must be a multiple of %d bytes.\n", h->w);
808 801 exit(1);
... ... @@ -810,8 +803,8 @@ void gf_set_region_data(gf_region_data *rd,
810 803  
811 804 rd->s_start = src;
812 805 rd->d_start = dest;
813   - rd->s_top = src + bytes;
814   - rd->d_top = src + bytes;
  806 + rd->s_top = (char*)src + bytes;
  807 + rd->d_top = (char*)src + bytes;
815 808 return;
816 809 }
817 810  
... ... @@ -840,12 +833,12 @@ void gf_set_region_data(gf_region_data *rd,
840 833  
841 834 uls %= a;
842 835 if (uls != 0) uls = (a-uls);
843   - rd->s_start = rd->src + uls;
844   - rd->d_start = rd->dest + uls;
  836 + rd->s_start = (char*)rd->src + uls;
  837 + rd->d_start = (char*)rd->dest + uls;
845 838 bytes -= uls;
846 839 bytes -= (bytes % align);
847   - rd->s_top = rd->s_start + bytes;
848   - rd->d_top = rd->d_start + bytes;
  840 + rd->s_top = (char*)rd->s_start + bytes;
  841 + rd->d_top = (char*)rd->d_start + bytes;
849 842  
850 843 }
851 844  
... ... @@ -856,7 +849,7 @@ void gf_do_initial_region_alignment(gf_region_data *rd)
856 849  
857 850 void gf_do_final_region_alignment(gf_region_data *rd)
858 851 {
859   - gf_slow_multiply_region(rd, rd->s_top, rd->d_top, rd->src+rd->bytes);
  852 + gf_slow_multiply_region(rd, rd->s_top, rd->d_top, (char*)rd->src+rd->bytes);
860 853 }
861 854  
862 855 void gf_multby_zero(void *dest, int bytes, int xor)
... ... @@ -897,9 +890,8 @@ void gf_multby_one(void *src, void *dest, int bytes, int xor)
897 890 __m128i ms, md;
898 891 #endif
899 892 unsigned long uls, uld;
900   - uint8_t *s8, *d8, *dtop8;
  893 + uint8_t *s8, *d8;
901 894 uint64_t *s64, *d64, *dtop64;
902   - int abytes;
903 895 gf_region_data rd;
904 896  
905 897 if (!xor) {
... ... @@ -910,6 +902,7 @@ void gf_multby_one(void *src, void *dest, int bytes, int xor)
910 902 uld = (unsigned long) dest;
911 903  
912 904 #ifdef INTEL_SSE2
  905 + int abytes;
913 906 s8 = (uint8_t *) src;
914 907 d8 = (uint8_t *) dest;
915 908 if (uls % 16 == uld % 16) {
... ... @@ -1025,7 +1018,7 @@ static void gf_unaligned_xor(void *src, void *dest, int bytes)
1025 1018 }
1026 1019  
1027 1020 d8 = (uint8_t *) d64;
1028   - while (d8 < (uint8_t *) (dest+bytes)) {
  1021 + while (d8 < (uint8_t *) ((char*)dest+bytes)) {
1029 1022 *d8 ^= *s8;
1030 1023 d8++;
1031 1024 s8++;
... ...
src/gf_general.c
... ... @@ -267,7 +267,6 @@ void gf_general_do_region_check(gf_t *gf, gf_general_t *a, void *orig_a, void *o
267 267 int w, words, i;
268 268 gf_general_t oa, ot, ft, sb;
269 269 char sa[50], soa[50], sot[50], sft[50], ssb[50];
270   - uint8_t *p;
271 270  
272 271 h = (gf_internal_t *) gf->scratch;
273 272 w = h->w;
... ... @@ -327,7 +326,7 @@ void gf_general_set_up_single_timing_test(int w, void *ra, void *rb, int size)
327 326 uint64_t *r64;
328 327 int i;
329 328  
330   - top = rb+size;
  329 + top = (char*)rb+size;
331 330  
332 331 /* If w is 8, 16, 32, 64 or 128, fill the regions with random bytes.
333 332 However, don't allow for zeros in rb, because that will screw up
... ... @@ -366,7 +365,7 @@ void gf_general_set_up_single_timing_test(int w, void *ra, void *rb, int size)
366 365 r64[1] = g.w128[1];
367 366 break;
368 367 }
369   - rb += (w/8);
  368 + rb = (char*)rb + (w/8);
370 369 }
371 370 } else if (w == 4) {
372 371 r8a = (uint8_t *) ra;
... ... @@ -408,7 +407,7 @@ int gf_general_do_single_timing_test(gf_t *gf, void *ra, void *rb, int size, cha
408 407  
409 408 h = (gf_internal_t *) gf->scratch;
410 409 w = h->w;
411   - top = ra + size;
  410 + top = (char*)ra + size;
412 411  
413 412 if (w == 8 || w == 4) {
414 413 r8a = (uint8_t *) ra;
... ...
src/gf_general.h
... ... @@ -1,61 +0,0 @@
1   -/*
2   - * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic
3   - * James S. Plank, Ethan L. Miller, Kevin M. Greenan,
4   - * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride.
5   - *
6   - * gf_general.h
7   - *
8   - * This file has helper routines for doing basic GF operations with any
9   - * legal value of w. The problem is that w <= 32, w=64 and w=128 all have
10   - * different data types, which is a pain. The procedures in this file try
11   - * to alleviate that pain. They are used in gf_unit and gf_time.
12   - */
13   -
14   -#pragma once
15   -
16   -#include <stdio.h>
17   -#include <getopt.h>
18   -#include <stdint.h>
19   -#include <string.h>
20   -#include <stdlib.h>
21   -#include <time.h>
22   -
23   -#include "gf_complete.h"
24   -
25   -typedef union {
26   - uint32_t w32;
27   - uint64_t w64;
28   - uint64_t w128[2];
29   -} gf_general_t;
30   -
31   -void gf_general_set_zero(gf_general_t *v, int w);
32   -void gf_general_set_one(gf_general_t *v, int w);
33   -void gf_general_set_two(gf_general_t *v, int w);
34   -
35   -int gf_general_is_zero(gf_general_t *v, int w);
36   -int gf_general_is_one(gf_general_t *v, int w);
37   -int gf_general_are_equal(gf_general_t *v1, gf_general_t *v2, int w);
38   -
39   -void gf_general_val_to_s(gf_general_t *v, int w, char *s, int hex);
40   -int gf_general_s_to_val(gf_general_t *v, int w, char *s, int hex);
41   -
42   -void gf_general_set_random(gf_general_t *v, int w, int zero_ok);
43   -
44   -void gf_general_add(gf_t *gf, gf_general_t *a, gf_general_t *b, gf_general_t *c);
45   -void gf_general_multiply(gf_t *gf, gf_general_t *a, gf_general_t *b, gf_general_t *c);
46   -void gf_general_divide(gf_t *gf, gf_general_t *a, gf_general_t *b, gf_general_t *c);
47   -void gf_general_inverse(gf_t *gf, gf_general_t *a, gf_general_t *b);
48   -
49   -void gf_general_do_region_multiply(gf_t *gf, gf_general_t *a,
50   - void *ra, void *rb,
51   - int bytes, int xor);
52   -
53   -void gf_general_do_region_check(gf_t *gf, gf_general_t *a,
54   - void *orig_a, void *orig_target, void *final_target,
55   - int bytes, int xor);
56   -
57   -
58   -/* Which is M, D or I for multiply, divide or inverse. */
59   -
60   -void gf_general_set_up_single_timing_test(int w, void *ra, void *rb, int size);
61   -int gf_general_do_single_timing_test(gf_t *gf, void *ra, void *rb, int size, char which);
src/gf_int.h
... ... @@ -1,200 +0,0 @@
1   -/*
2   - * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic
3   - * James S. Plank, Ethan L. Miller, Kevin M. Greenan,
4   - * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride.
5   - *
6   - * gf_int.h
7   - *
8   - * Internal code for Galois field routines. This is not meant for
9   - * users to include, but for the internal GF files to use.
10   - */
11   -
12   -#pragma once
13   -
14   -#include "gf_complete.h"
15   -
16   -#include <string.h>
17   -
18   -extern void timer_start (double *t);
19   -extern double timer_split (const double *t);
20   -extern void galois_fill_random (void *buf, int len, unsigned int seed);
21   -
22   -typedef struct {
23   - int mult_type;
24   - int region_type;
25   - int divide_type;
26   - int w;
27   - uint64_t prim_poly;
28   - int free_me;
29   - int arg1;
30   - int arg2;
31   - gf_t *base_gf;
32   - void *private;
33   -} gf_internal_t;
34   -
35   -extern int gf_w4_init (gf_t *gf);
36   -extern int gf_w4_scratch_size(int mult_type, int region_type, int divide_type, int arg1, int arg2);
37   -
38   -extern int gf_w8_init (gf_t *gf);
39   -extern int gf_w8_scratch_size(int mult_type, int region_type, int divide_type, int arg1, int arg2);
40   -
41   -extern int gf_w16_init (gf_t *gf);
42   -extern int gf_w16_scratch_size(int mult_type, int region_type, int divide_type, int arg1, int arg2);
43   -
44   -extern int gf_w32_init (gf_t *gf);
45   -extern int gf_w32_scratch_size(int mult_type, int region_type, int divide_type, int arg1, int arg2);
46   -
47   -extern int gf_w64_init (gf_t *gf);
48   -extern int gf_w64_scratch_size(int mult_type, int region_type, int divide_type, int arg1, int arg2);
49   -
50   -extern int gf_w128_init (gf_t *gf);
51   -extern int gf_w128_scratch_size(int mult_type, int region_type, int divide_type, int arg1, int arg2);
52   -
53   -extern int gf_wgen_init (gf_t *gf);
54   -extern int gf_wgen_scratch_size(int w, int mult_type, int region_type, int divide_type, int arg1, int arg2);
55   -
56   -void gf_wgen_cauchy_region(gf_t *gf, void *src, void *dest, gf_val_32_t val, int bytes, int xor);
57   -gf_val_32_t gf_wgen_extract_word(gf_t *gf, void *start, int bytes, int index);
58   -
59   -extern void gf_alignment_error(char *s, int a);
60   -
61   -extern uint32_t gf_bitmatrix_inverse(uint32_t y, int w, uint32_t pp);
62   -
63   -/* This returns the correct default for prim_poly when base is used as the base
64   - field for COMPOSITE. It returns 0 if we don't have a default prim_poly. */
65   -
66   -extern uint64_t gf_composite_get_default_poly(gf_t *base);
67   -
68   -/* This structure lets you define a region multiply. It helps because you can handle
69   - unaligned portions of the data with the procedures below, which really cleans
70   - up the code. */
71   -
72   -typedef struct {
73   - gf_t *gf;
74   - void *src;
75   - void *dest;
76   - int bytes;
77   - uint64_t val;
78   - int xor;
79   - int align; /* The number of bytes to which to align. */
80   - void *s_start; /* The start and the top of the aligned region. */
81   - void *d_start;
82   - void *s_top;
83   - void *d_top;
84   -} gf_region_data;
85   -
86   -/* This lets you set up one of these in one call. It also sets the start/top pointers. */
87   -
88   -void gf_set_region_data(gf_region_data *rd,
89   - gf_t *gf,
90   - void *src,
91   - void *dest,
92   - int bytes,
93   - uint64_t val,
94   - int xor,
95   - int align);
96   -
97   -/* This performs gf->multiply.32() on all of the unaligned bytes in the beginning of the region */
98   -
99   -extern void gf_do_initial_region_alignment(gf_region_data *rd);
100   -
101   -/* This performs gf->multiply.32() on all of the unaligned bytes in the end of the region */
102   -
103   -extern void gf_do_final_region_alignment(gf_region_data *rd);
104   -
105   -extern void gf_two_byte_region_table_multiply(gf_region_data *rd, uint16_t *base);
106   -
107   -extern void gf_multby_zero(void *dest, int bytes, int xor);
108   -extern void gf_multby_one(void *src, void *dest, int bytes, int xor);
109   -
110   -typedef enum {GF_E_MDEFDIV, /* Dev != Default && Mult == Default */
111   - GF_E_MDEFREG, /* Reg != Default && Mult == Default */
112   - GF_E_MDEFARG, /* Args != Default && Mult == Default */
113   - GF_E_DIVCOMP, /* Mult == Composite && Div != Default */
114   - GF_E_CAUCOMP, /* Mult == Composite && Reg == CAUCHY */
115   - GF_E_DOUQUAD, /* Reg == DOUBLE && Reg == QUAD */
116   - GF_E_SSE__NO, /* Reg == SSE && Reg == NOSSE */
117   - GF_E_CAUCHYB, /* Reg == CAUCHY && Other Reg */
118   - GF_E_CAUGT32, /* Reg == CAUCHY && w > 32*/
119   - GF_E_ARG1SET, /* Arg1 != 0 && Mult \notin COMPOSITE/SPLIT/GROUP */
120   - GF_E_ARG2SET, /* Arg2 != 0 && Mult \notin SPLIT/GROUP */
121   - GF_E_MATRIXW, /* Div == MATRIX && w > 32 */
122   - GF_E_BAD___W, /* Illegal w */
123   - GF_E_DOUBLET, /* Reg == DOUBLE && Mult != TABLE */
124   - GF_E_DOUBLEW, /* Reg == DOUBLE && w \notin {4,8} */
125   - GF_E_DOUBLEJ, /* Reg == DOUBLE && other Reg */
126   - GF_E_DOUBLEL, /* Reg == DOUBLE & LAZY but w = 4 */
127   - GF_E_QUAD__T, /* Reg == QUAD && Mult != TABLE */
128   - GF_E_QUAD__W, /* Reg == QUAD && w != 4 */
129   - GF_E_QUAD__J, /* Reg == QUAD && other Reg */
130   - GF_E_LAZY__X, /* Reg == LAZY && not DOUBLE or QUAD*/
131   - GF_E_ALTSHIF, /* Mult == Shift && Reg == ALTMAP */
132   - GF_E_SSESHIF, /* Mult == Shift && Reg == SSE|NOSSE */
133   - GF_E_ALT_CFM, /* Mult == CARRY_FREE && Reg == ALTMAP */
134   - GF_E_SSE_CFM, /* Mult == CARRY_FREE && Reg == SSE|NOSSE */
135   - GF_E_PCLMULX, /* Mult == Carry_Free && No PCLMUL */
136   - GF_E_ALT_BY2, /* Mult == Bytwo_x && Reg == ALTMAP */
137   - GF_E_BY2_SSE, /* Mult == Bytwo_x && Reg == SSE && No SSE2 */
138   - GF_E_LOGBADW, /* Mult == LOGx, w too big*/
139   - GF_E_LOG___J, /* Mult == LOGx, && Reg == SSE|ALTMAP|NOSSE */
140   - GF_E_ZERBADW, /* Mult == LOG_ZERO, w \notin {8,16} */
141   - GF_E_ZEXBADW, /* Mult == LOG_ZERO_EXT, w != 8 */
142   - GF_E_LOGPOLY, /* Mult == LOG & poly not primitive */
143   - GF_E_GR_ARGX, /* Mult == GROUP, Bad arg1/2 */
144   - GF_E_GR_W_48, /* Mult == GROUP, w \in { 4, 8 } */
145   - GF_E_GR_W_16, /* Mult == GROUP, w == 16, arg1 != 4 || arg2 != 4 */
146   - GF_E_GR_128A, /* Mult == GROUP, w == 128, bad args */
147   - GF_E_GR_A_27, /* Mult == GROUP, either arg > 27 */
148   - GF_E_GR_AR_W, /* Mult == GROUP, either arg > w */
149   - GF_E_GR____J, /* Mult == GROUP, Reg == SSE|ALTMAP|NOSSE */
150   - GF_E_TABLE_W, /* Mult == TABLE, w too big */
151   - GF_E_TAB_SSE, /* Mult == TABLE, SSE|NOSSE only apply to w == 4 */
152   - GF_E_TABSSE3, /* Mult == TABLE, Need SSSE3 for SSE */
153   - GF_E_TAB_ALT, /* Mult == TABLE, Reg == ALTMAP */
154   - GF_E_SP128AR, /* Mult == SPLIT, w=128, Bad arg1/arg2 */
155   - GF_E_SP128AL, /* Mult == SPLIT, w=128, SSE requires ALTMAP */
156   - GF_E_SP128AS, /* Mult == SPLIT, w=128, ALTMAP requires SSE */
157   - GF_E_SP128_A, /* Mult == SPLIT, w=128, SSE only with 4/128 */
158   - GF_E_SP128_S, /* Mult == SPLIT, w=128, ALTMAP only with 4/128 */
159   - GF_E_SPLIT_W, /* Mult == SPLIT, Bad w (8, 16, 32, 64, 128) */
160   - GF_E_SP_16AR, /* Mult == SPLIT, w=16, Bad arg1/arg2 */
161   - GF_E_SP_16_A, /* Mult == SPLIT, w=16, ALTMAP only with 4/16 */
162   - GF_E_SP_16_S, /* Mult == SPLIT, w=16, SSE only with 4/16 */
163   - GF_E_SP_32AR, /* Mult == SPLIT, w=32, Bad arg1/arg2 */
164   - GF_E_SP_32AS, /* Mult == SPLIT, w=32, ALTMAP requires SSE */
165   - GF_E_SP_32_A, /* Mult == SPLIT, w=32, ALTMAP only with 4/32 */
166   - GF_E_SP_32_S, /* Mult == SPLIT, w=32, SSE only with 4/32 */
167   - GF_E_SP_64AR, /* Mult == SPLIT, w=64, Bad arg1/arg2 */
168   - GF_E_SP_64AS, /* Mult == SPLIT, w=64, ALTMAP requires SSE */
169   - GF_E_SP_64_A, /* Mult == SPLIT, w=64, ALTMAP only with 4/64 */
170   - GF_E_SP_64_S, /* Mult == SPLIT, w=64, SSE only with 4/64 */
171   - GF_E_SP_8_AR, /* Mult == SPLIT, w=8, Bad arg1/arg2 */
172   - GF_E_SP_8__A, /* Mult == SPLIT, w=8, no ALTMAP */
173   - GF_E_SP_SSE3, /* Mult == SPLIT, Need SSSE3 for SSE */
174   - GF_E_COMP_A2, /* Mult == COMP, arg1 must be = 2 */
175   - GF_E_COMP_SS, /* Mult == COMP, SSE|NOSSE */
176   - GF_E_COMP__W, /* Mult == COMP, Bad w. */
177   - GF_E_UNKFLAG, /* Unknown flag in create_from.... */
178   - GF_E_UNKNOWN, /* Unknown mult_type. */
179   - GF_E_UNK_REG, /* Unknown region_type. */
180   - GF_E_UNK_DIV, /* Unknown divide_type. */
181   - GF_E_CFM___W, /* Mult == CFM, Bad w. */
182   - GF_E_CFM4POL, /* Mult == CFM & Prim Poly has high bits set. */
183   - GF_E_CFM8POL, /* Mult == CFM & Prim Poly has high bits set. */
184   - GF_E_CF16POL, /* Mult == CFM & Prim Poly has high bits set. */
185   - GF_E_CF32POL, /* Mult == CFM & Prim Poly has high bits set. */
186   - GF_E_CF64POL, /* Mult == CFM & Prim Poly has high bits set. */
187   - GF_E_FEWARGS, /* Too few args in argc/argv. */
188   - GF_E_BADPOLY, /* Bad primitive polynomial -- too many bits set. */
189   - GF_E_COMP_PP, /* Bad primitive polynomial -- bigger than sub-field. */
190   - GF_E_COMPXPP, /* Can't derive a default pp for composite field. */
191   - GF_E_BASE__W, /* Composite -- Base field is the wrong size. */
192   - GF_E_TWOMULT, /* In create_from... two -m's. */
193   - GF_E_TWO_DIV, /* In create_from... two -d's. */
194   - GF_E_POLYSPC, /* Bad numbera after -p. */
195   - GF_E_SPLITAR, /* Ran out of arguments in SPLIT */
196   - GF_E_SPLITNU, /* Arguments not integers in SPLIT. */
197   - GF_E_GROUPAR, /* Ran out of arguments in GROUP */
198   - GF_E_GROUPNU, /* Arguments not integers in GROUP. */
199   - GF_E_DEFAULT } gf_error_type_t;
200   -
src/gf_method.c
... ... @@ -21,10 +21,9 @@
21 21 int create_gf_from_argv(gf_t *gf, int w, int argc, char **argv, int starting)
22 22 {
23 23 int mult_type, divide_type, region_type;
24   - int arg1, arg2, subrg_size;
  24 + int arg1, arg2;
25 25 uint64_t prim_poly;
26 26 gf_t *base;
27   - char *crt, *x, *y;
28 27  
29 28 mult_type = GF_MULT_DEFAULT;
30 29 region_type = GF_REGION_DEFAULT;
... ...
src/gf_rand.h
... ... @@ -1,22 +0,0 @@
1   -/*
2   - * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic
3   - * James S. Plank, Ethan L. Miller, Kevin M. Greenan,
4   - * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride.
5   - *
6   - * gf_rand.h
7   - *
8   - * Random number generation, using the "Mother of All" random number generator. */
9   -
10   -#pragma once
11   -#include <stdint.h>
12   -#include <stdio.h>
13   -#include <stdlib.h>
14   -
15   -/* These are all pretty self-explanatory */
16   -uint32_t MOA_Random_32();
17   -uint64_t MOA_Random_64();
18   -void MOA_Random_128(uint64_t *x);
19   -uint32_t MOA_Random_W(int w, int zero_ok);
20   -void MOA_Fill_Random_Region (void *reg, int size); /* reg should be aligned to 4 bytes, but
21   - size can be anything. */
22   -void MOA_Seed(uint32_t seed);
src/gf_w128.c
... ... @@ -81,6 +81,7 @@ int xor)
81 81 }
82 82 }
83 83  
  84 +#if defined(INTEL_SSE4_PCLMUL)
84 85 static
85 86 void
86 87 gf_w128_clm_multiply_region_from_single(gf_t *gf, void *src, void *dest, gf_val_128_t val, int bytes,
... ... @@ -89,9 +90,7 @@ int xor)
89 90 int i;
90 91 gf_val_128_t s128;
91 92 gf_val_128_t d128;
92   - uint64_t c128[2];
93 93 gf_region_data rd;
94   -#if defined(INTEL_SSE4_PCLMUL)
95 94 __m128i a,b;
96 95 __m128i result0,result1;
97 96 __m128i prim_poly;
... ... @@ -106,8 +105,6 @@ int xor)
106 105 if (val[1] == 1) { gf_multby_one(src, dest, bytes, xor); return; }
107 106 }
108 107  
109   - set_zero(c128, 0);
110   -
111 108 s128 = (gf_val_128_t) src;
112 109 d128 = (gf_val_128_t) dest;
113 110  
... ... @@ -184,8 +181,8 @@ int xor)
184 181 d128[i+1] = (uint64_t)_mm_extract_epi64(result1,0);
185 182 }
186 183 }
187   -#endif
188 184 }
  185 +#endif
189 186  
190 187 /*
191 188 * Some w128 notes:
... ... @@ -384,7 +381,7 @@ gf_w128_sse_bytwo_p_multiply(gf_t *gf, gf_val_128_t a128, gf_val_128_t b128, gf_
384 381 {
385 382 #if defined(INTEL_SSE4)
386 383 int i;
387   - __m128i a, b, pp, one, prod, amask, l_middle_one, u_middle_one;
  384 + __m128i a, b, pp, prod, amask, u_middle_one;
388 385 /*John: pmask is always the highest bit set, and the rest zeros. amask changes, it's a countdown.*/
389 386 uint32_t topbit, middlebit, pmask; /* this is used as a boolean value */
390 387 gf_internal_t *h;
... ... @@ -400,7 +397,6 @@ gf_w128_sse_bytwo_p_multiply(gf_t *gf, gf_val_128_t a128, gf_val_128_t b128, gf_
400 397 pmask = 0x80000000;
401 398 amask = _mm_insert_epi32(prod, 0x80000000, 0x3);
402 399 u_middle_one = _mm_insert_epi32(prod, 1, 0x2);
403   - l_middle_one = _mm_insert_epi32(prod, 1 << 31, 0x1);
404 400  
405 401 for (i = 0; i < 64; i++) {
406 402 topbit = (_mm_extract_epi32(prod, 0x3) & pmask);
... ... @@ -599,13 +595,13 @@ gf_w128_split_4_128_multiply_region(gf_t *gf, void *src, void *dest, gf_val_128_
599 595 }
600 596 }
601 597  
  598 +#ifdef INTEL_SSSE3
602 599 static
603 600 void
604 601 gf_w128_split_4_128_sse_multiply_region(gf_t *gf, void *src, void *dest, gf_val_128_t val, int bytes, int xor)
605 602 {
606   -#ifdef INTEL_SSSE3
607 603 gf_internal_t *h;
608   - int i, m, j, k, tindex;
  604 + int i, j, k;
609 605 uint64_t pp, v[2], s, *s64, *d64, *top;
610 606 __m128i p, tables[32][16];
611 607 struct gf_w128_split_4_128_data *ld;
... ... @@ -624,7 +620,7 @@ gf_w128_split_4_128_sse_multiply_region(gf_t *gf, void *src, void *dest, gf_val_
624 620  
625 621 /* Doing this instead of gf_do_initial_region_alignment() because that doesn't hold 128-bit vals */
626 622  
627   - gf_w128_multiply_region_from_single(gf, src, dest, val, (rd.s_start-src), xor);
  623 + gf_w128_multiply_region_from_single(gf, src, dest, val, ((char*)rd.s_start-(char*)src), xor);
628 624  
629 625 s64 = (uint64_t *) rd.s_start;
630 626 d64 = (uint64_t *) rd.d_start;
... ... @@ -694,18 +690,18 @@ gf_w128_split_4_128_sse_multiply_region(gf_t *gf, void *src, void *dest, gf_val_
694 690  
695 691 /* Doing this instead of gf_do_final_region_alignment() because that doesn't hold 128-bit vals */
696 692  
697   - gf_w128_multiply_region_from_single(gf, rd.s_top, rd.d_top, val, (src+bytes)-rd.s_top, xor);
698   -#endif
  693 + gf_w128_multiply_region_from_single(gf, rd.s_top, rd.d_top, val, ((char*)src+bytes)-(char*)rd.s_top, xor);
699 694 }
  695 +#endif
700 696  
  697 +#ifdef INTEL_SSSE3
701 698 static
702 699 void
703 700 gf_w128_split_4_128_sse_altmap_multiply_region(gf_t *gf, void *src, void *dest, gf_val_128_t val, int bytes, int xor)
704 701 {
705   -#ifdef INTEL_SSSE3
706 702 gf_internal_t *h;
707   - int i, m, j, k, tindex;
708   - uint64_t pp, v[2], s, *s64, *d64, *top;
  703 + int i, j, k;
  704 + uint64_t pp, v[2], *s64, *d64, *top;
709 705 __m128i si, tables[32][16], p[16], v0, mask1;
710 706 struct gf_w128_split_4_128_data *ld;
711 707 uint8_t btable[16];
... ... @@ -724,7 +720,7 @@ gf_w128_split_4_128_sse_altmap_multiply_region(gf_t *gf, void *src, void *dest,
724 720  
725 721 /* Doing this instead of gf_do_initial_region_alignment() because that doesn't hold 128-bit vals */
726 722  
727   - gf_w128_multiply_region_from_single(gf, src, dest, val, (rd.s_start-src), xor);
  723 + gf_w128_multiply_region_from_single(gf, src, dest, val, ((char*)rd.s_start-(char*)src), xor);
728 724  
729 725 s64 = (uint64_t *) rd.s_start;
730 726 d64 = (uint64_t *) rd.d_start;
... ... @@ -804,9 +800,9 @@ gf_w128_split_4_128_sse_altmap_multiply_region(gf_t *gf, void *src, void *dest,
804 800 }
805 801 /* Doing this instead of gf_do_final_region_alignment() because that doesn't hold 128-bit vals */
806 802  
807   - gf_w128_multiply_region_from_single(gf, rd.s_top, rd.d_top, val, (src+bytes)-rd.s_top, xor);
808   -#endif
  803 + gf_w128_multiply_region_from_single(gf, rd.s_top, rd.d_top, val, ((char*)src+bytes)-(char*)rd.s_top, xor);
809 804 }
  805 +#endif
810 806  
811 807 static
812 808 void
... ... @@ -886,7 +882,7 @@ gf_w128_split_8_128_multiply_region(gf_t *gf, void *src, void *dest, gf_val_128_
886 882 void
887 883 gf_w128_bytwo_b_multiply_region(gf_t *gf, void *src, void *dest, gf_val_128_t val, int bytes, int xor)
888 884 {
889   - uint64_t bmask, pp, vmask;
  885 + uint64_t bmask, pp;
890 886 gf_internal_t *h;
891 887 uint64_t a[2], c[2], b[2], *s64, *d64, *top;
892 888 gf_region_data rd;
... ... @@ -987,7 +983,7 @@ void gf_w128_group_m_init(gf_t *gf, gf_val_128_t b128)
987 983 void
988 984 gf_w128_group_multiply(GFP gf, gf_val_128_t a128, gf_val_128_t b128, gf_val_128_t c128)
989 985 {
990   - int i,j;
  986 + int i;
991 987 /* index_r, index_m, total_m (if g_r > g_m) */
992 988 int i_r, i_m, t_m;
993 989 int mask_m, mask_r;
... ... @@ -1162,11 +1158,12 @@ gf_w128_euclid(GFP gf, gf_val_128_t a128, gf_val_128_t b128)
1162 1158 uint64_t c_i[2];
1163 1159 uint64_t *b;
1164 1160 uint64_t one = 1;
1165   - uint64_t buf, buf1;
1166 1161  
1167 1162 /* This needs to return some sort of error (in b128?) */
1168 1163 if (a128[0] == 0 && a128[1] == 0) return;
1169 1164  
  1165 + b = (uint64_t *) b128;
  1166 +
1170 1167 e_im1[0] = 0;
1171 1168 e_im1[1] = ((gf_internal_t *) (gf->scratch))->prim_poly;
1172 1169 e_i[0] = a128[0];
... ... @@ -1240,7 +1237,6 @@ gf_w128_euclid(GFP gf, gf_val_128_t a128, gf_val_128_t b128)
1240 1237 d_i = d_ip1;
1241 1238 }
1242 1239  
1243   - b = (uint64_t *) b128;
1244 1240 b[0] = y_i[0];
1245 1241 b[1] = y_i[1];
1246 1242 return;
... ... @@ -1326,7 +1322,6 @@ static
1326 1322 void
1327 1323 gf_w128_composite_multiply_region(gf_t *gf, void *src, void *dest, gf_val_128_t val, int bytes, int xor)
1328 1324 {
1329   - unsigned long uls, uld;
1330 1325 gf_internal_t *h = (gf_internal_t *) gf->scratch;
1331 1326 gf_t *base_gf = h->base_gf;
1332 1327 uint64_t b0 = val[1];
... ... @@ -1381,14 +1376,13 @@ gf_w128_composite_multiply_region_alt(gf_t *gf, void *src, void *dest, gf_val_12
1381 1376 gf_internal_t *h = (gf_internal_t *) gf->scratch; gf_t *base_gf = h->base_gf;
1382 1377 gf_val_64_t val0 = val[1];
1383 1378 gf_val_64_t val1 = val[0];
1384   - uint64_t *l, *hi;
1385 1379 uint8_t *slow, *shigh;
1386 1380 uint8_t *dlow, *dhigh, *top;
1387 1381 int sub_reg_size;
1388 1382 gf_region_data rd;
1389 1383  
1390 1384 gf_set_region_data(&rd, gf, src, dest, bytes, 0, xor, 64);
1391   - gf_w128_multiply_region_from_single(gf, src, dest, val, (rd.s_start-src), xor);
  1385 + gf_w128_multiply_region_from_single(gf, src, dest, val, ((char*)rd.s_start-(char*)src), xor);
1392 1386  
1393 1387 slow = (uint8_t *) rd.s_start;
1394 1388 dlow = (uint8_t *) rd.d_start;
... ... @@ -1404,7 +1398,7 @@ gf_w128_composite_multiply_region_alt(gf_t *gf, void *src, void *dest, gf_val_12
1404 1398 base_gf->multiply_region.w64(base_gf, shigh, dhigh, base_gf->multiply.w64(base_gf, h->prim_poly, val1
1405 1399 ), sub_reg_size, 1);
1406 1400  
1407   - gf_w128_multiply_region_from_single(gf, rd.s_top, rd.d_top, val, (src+bytes)-rd.s_top, xor);
  1401 + gf_w128_multiply_region_from_single(gf, rd.s_top, rd.d_top, val, ((char*)src+bytes)-(char*)rd.s_top, xor);
1408 1402 }
1409 1403  
1410 1404  
... ... @@ -1419,8 +1413,6 @@ int gf_w128_composite_init(gf_t *gf)
1419 1413 gf->multiply_region.w128 = gf_w128_composite_multiply_region;
1420 1414 }
1421 1415  
1422   - gf_internal_t *base_h = (gf_internal_t *) h->base_gf->scratch;
1423   -
1424 1416 gf->multiply.w128 = gf_w128_composite_multiply;
1425 1417 gf->divide.w128 = gf_w128_divide_from_inverse;
1426 1418 gf->inverse.w128 = gf_w128_composite_inverse;
... ... @@ -1444,8 +1436,6 @@ int gf_w128_cfm_init(gf_t *gf)
1444 1436 static
1445 1437 int gf_w128_shift_init(gf_t *gf)
1446 1438 {
1447   - gf_internal_t *h;
1448   - h = (gf_internal_t*) gf->scratch;
1449 1439 gf->multiply.w128 = gf_w128_shift_multiply;
1450 1440 gf->inverse.w128 = gf_w128_euclid;
1451 1441 gf->multiply_region.w128 = gf_w128_multiply_region_from_single;
... ... @@ -1501,10 +1491,10 @@ void gf_w128_group_r_init(gf_t *gf)
1501 1491 return;
1502 1492 }
1503 1493  
  1494 +#if 0 // defined(INTEL_SSE4)
1504 1495 static
1505 1496 void gf_w128_group_r_sse_init(gf_t *gf)
1506 1497 {
1507   -#if defined(INTEL_SSE4)
1508 1498 int i, j;
1509 1499 int g_r;
1510 1500 uint64_t pp;
... ... @@ -1526,8 +1516,8 @@ void gf_w128_group_r_sse_init(gf_t *gf)
1526 1516 }
1527 1517 }
1528 1518 return;
1529   -#endif
1530 1519 }
  1520 +#endif
1531 1521  
1532 1522 static
1533 1523 int gf_w128_split_init(gf_t *gf)
... ... @@ -1587,12 +1577,10 @@ int gf_w128_group_init(gf_t *gf)
1587 1577 {
1588 1578 gf_internal_t *scratch;
1589 1579 gf_group_tables_t *gt;
1590   - int g_m, g_r, size_r;
1591   - long tmp;
  1580 + int g_r, size_r;
1592 1581  
1593 1582 scratch = (gf_internal_t *) gf->scratch;
1594 1583 gt = scratch->private;
1595   - g_m = scratch->arg1;
1596 1584 g_r = scratch->arg2;
1597 1585 size_r = (1 << g_r);
1598 1586  
... ... @@ -1690,7 +1678,6 @@ void gf_w128_composite_extract_word(gf_t *gf, void *start, int bytes, int index,
1690 1678 int gf_w128_scratch_size(int mult_type, int region_type, int divide_type, int arg1, int arg2)
1691 1679 {
1692 1680 int size_m, size_r;
1693   - int w = 128;
1694 1681 if (divide_type==GF_DIVIDE_MATRIX) return 0;
1695 1682  
1696 1683 switch(mult_type)
... ... @@ -1739,7 +1726,7 @@ int gf_w128_scratch_size(int mult_type, int region_type, int divide_type, int ar
1739 1726  
1740 1727 int gf_w128_init(gf_t *gf)
1741 1728 {
1742   - gf_internal_t *h, *h_base, *h_base_base, *h_base_base_base;
  1729 + gf_internal_t *h;
1743 1730 int no_default_flag = 0;
1744 1731  
1745 1732 h = (gf_internal_t *) gf->scratch;
... ...
src/gf_w16.c
... ... @@ -125,6 +125,7 @@ gf_w16_multiply_region_from_single(gf_t *gf, void *src, void *dest, gf_val_32_t
125 125 gf_do_final_region_alignment(&rd);
126 126 }
127 127  
  128 +#if defined(INTEL_SSE4_PCLMUL)
128 129 static
129 130 void
130 131 gf_w16_clm_multiply_region_from_single_2(gf_t *gf, void *src, void *dest, gf_val_32_t val, int bytes, int xor)
... ... @@ -132,8 +133,6 @@ gf_w16_clm_multiply_region_from_single_2(gf_t *gf, void *src, void *dest, gf_val
132 133 gf_region_data rd;
133 134 uint16_t *s16;
134 135 uint16_t *d16;
135   -
136   -#if defined(INTEL_SSE4_PCLMUL)
137 136 __m128i a, b;
138 137 __m128i result;
139 138 __m128i prim_poly;
... ... @@ -186,9 +185,10 @@ gf_w16_clm_multiply_region_from_single_2(gf_t *gf, void *src, void *dest, gf_val
186 185 }
187 186 }
188 187 gf_do_final_region_alignment(&rd);
189   -#endif
190 188 }
  189 +#endif
191 190  
  191 +#if defined(INTEL_SSE4_PCLMUL)
192 192 static
193 193 void
194 194 gf_w16_clm_multiply_region_from_single_3(gf_t *gf, void *src, void *dest, gf_val_32_t val, int bytes, int xor)
... ... @@ -197,8 +197,6 @@ gf_w16_clm_multiply_region_from_single_3(gf_t *gf, void *src, void *dest, gf_val
197 197 uint16_t *s16;
198 198 uint16_t *d16;
199 199  
200   -#if defined(INTEL_SSE4_PCLMUL)
201   -
202 200 __m128i a, b;
203 201 __m128i result;
204 202 __m128i prim_poly;
... ... @@ -255,9 +253,10 @@ gf_w16_clm_multiply_region_from_single_3(gf_t *gf, void *src, void *dest, gf_val
255 253 }
256 254 }
257 255 gf_do_final_region_alignment(&rd);
258   -#endif
259 256 }
  257 +#endif
260 258  
  259 +#if defined(INTEL_SSE4_PCLMUL)
261 260 static
262 261 void
263 262 gf_w16_clm_multiply_region_from_single_4(gf_t *gf, void *src, void *dest, gf_val_32_t val, int bytes, int xor)
... ... @@ -266,8 +265,6 @@ gf_w16_clm_multiply_region_from_single_4(gf_t *gf, void *src, void *dest, gf_val
266 265 uint16_t *s16;
267 266 uint16_t *d16;
268 267  
269   -#if defined(INTEL_SSE4_PCLMUL)
270   -
271 268 __m128i a, b;
272 269 __m128i result;
273 270 __m128i prim_poly;
... ... @@ -328,8 +325,8 @@ gf_w16_clm_multiply_region_from_single_4(gf_t *gf, void *src, void *dest, gf_val
328 325 }
329 326 }
330 327 gf_do_final_region_alignment(&rd);
331   -#endif
332 328 }
  329 +#endif
333 330  
334 331 static
335 332 inline
... ... @@ -453,7 +450,7 @@ gf_w16_clm_multiply_2 (gf_t *gf, gf_val_32_t a16, gf_val_32_t b16)
453 450 __m128i a, b;
454 451 __m128i result;
455 452 __m128i prim_poly;
456   - __m128i v, w;
  453 + __m128i w;
457 454 gf_internal_t * h = gf->scratch;
458 455  
459 456 a = _mm_insert_epi32 (_mm_setzero_si128(), a16, 0);
... ... @@ -500,7 +497,7 @@ gf_w16_clm_multiply_3 (gf_t *gf, gf_val_32_t a16, gf_val_32_t b16)
500 497 __m128i a, b;
501 498 __m128i result;
502 499 __m128i prim_poly;
503   - __m128i v, w;
  500 + __m128i w;
504 501 gf_internal_t * h = gf->scratch;
505 502  
506 503 a = _mm_insert_epi32 (_mm_setzero_si128(), a16, 0);
... ... @@ -540,7 +537,7 @@ gf_w16_clm_multiply_4 (gf_t *gf, gf_val_32_t a16, gf_val_32_t b16)
540 537 __m128i a, b;
541 538 __m128i result;
542 539 __m128i prim_poly;
543   - __m128i v, w;
  540 + __m128i w;
544 541 gf_internal_t * h = gf->scratch;
545 542  
546 543 a = _mm_insert_epi32 (_mm_setzero_si128(), a16, 0);
... ... @@ -605,13 +602,13 @@ int gf_w16_shift_init(gf_t *gf)
605 602 static
606 603 int gf_w16_cfm_init(gf_t *gf)
607 604 {
  605 +#if defined(INTEL_SSE4_PCLMUL)
608 606 gf_internal_t *h;
609 607  
610 608 h = (gf_internal_t *) gf->scratch;
611 609  
612 610 /*Ben: Determining how many reductions to do */
613 611  
614   -#if defined(INTEL_SSE4_PCLMUL)
615 612 if ((0xfe00 & h->prim_poly) == 0) {
616 613 gf->multiply.w32 = gf_w16_clm_multiply_2;
617 614 gf->multiply_region.w32 = gf_w16_clm_multiply_region_from_single_2;
... ... @@ -774,9 +771,8 @@ static
774 771 void
775 772 gf_w16_split_4_16_lazy_nosse_altmap_multiply_region(gf_t *gf, void *src, void *dest, gf_val_32_t val, int bytes, int xor)
776 773 {
777   - uint64_t i, j, a, b, c, prod;
  774 + uint64_t i, j, c, prod;
778 775 uint8_t *s8, *d8, *top;
779   - gf_internal_t *h;
780 776 uint16_t table[4][16];
781 777 gf_region_data rd;
782 778  
... ... @@ -786,8 +782,6 @@ gf_w16_split_4_16_lazy_nosse_altmap_multiply_region(gf_t *gf, void *src, void *d
786 782 gf_set_region_data(&rd, gf, src, dest, bytes, val, xor, 32);
787 783 gf_do_initial_region_alignment(&rd);
788 784  
789   - h = (gf_internal_t *) gf->scratch;
790   -
791 785 /*Ben: Constructs lazy multiplication table*/
792 786  
793 787 for (j = 0; j < 16; j++) {
... ... @@ -840,7 +834,6 @@ gf_w16_split_4_16_lazy_multiply_region(gf_t *gf, void *src, void *dest, gf_val_3
840 834 {
841 835 uint64_t i, j, a, c, prod;
842 836 uint16_t *s16, *d16, *top;
843   - gf_internal_t *h;
844 837 uint16_t table[4][16];
845 838 gf_region_data rd;
846 839  
... ... @@ -850,8 +843,6 @@ gf_w16_split_4_16_lazy_multiply_region(gf_t *gf, void *src, void *dest, gf_val_3
850 843 gf_set_region_data(&rd, gf, src, dest, bytes, val, xor, 2);
851 844 gf_do_initial_region_alignment(&rd);
852 845  
853   - h = (gf_internal_t *) gf->scratch;
854   -
855 846 for (j = 0; j < 16; j++) {
856 847 for (i = 0; i < 4; i++) {
857 848 c = (j << (i*4));
... ... @@ -880,7 +871,7 @@ static
880 871 void
881 872 gf_w16_split_8_16_lazy_multiply_region(gf_t *gf, void *src, void *dest, gf_val_32_t val, int bytes, int xor)
882 873 {
883   - uint64_t j, k, v, a, c, prod, *s64, *d64, *top64;
  874 + uint64_t j, k, v, a, prod, *s64, *d64, *top64;
884 875 gf_internal_t *h;
885 876 uint64_t htable[256], ltable[256];
886 877 gf_region_data rd;
... ... @@ -966,7 +957,7 @@ gf_w16_split_8_16_lazy_multiply_region(gf_t *gf, void *src, void *dest, gf_val_3
966 957 static void
967 958 gf_w16_table_lazy_multiply_region(gf_t *gf, void *src, void *dest, gf_val_32_t val, int bytes, int xor)
968 959 {
969   - uint64_t j, a, c, pp;
  960 + uint64_t c;
970 961 gf_internal_t *h;
971 962 struct gf_w16_lazytable_data *ltd;
972 963 gf_region_data rd;
... ... @@ -1010,12 +1001,12 @@ gf_w16_split_4_16_lazy_sse_multiply_region(gf_t *gf, void *src, void *dest, gf_v
1010 1001 {
1011 1002 #ifdef INTEL_SSSE3
1012 1003 uint64_t i, j, *s64, *d64, *top64;;
1013   - uint64_t a, c, prod;
  1004 + uint64_t c, prod;
1014 1005 uint8_t low[4][16];
1015 1006 uint8_t high[4][16];
1016 1007 gf_region_data rd;
1017 1008  
1018   - __m128i mask, ta, tb, ti, tpl, tph, tlow[4], thigh[4], tta, ttb, shuffler, unshuffler, lmask;
  1009 + __m128i mask, ta, tb, ti, tpl, tph, tlow[4], thigh[4], tta, ttb, lmask;
1019 1010  
1020 1011 if (val == 0) { gf_multby_zero(dest, bytes, xor); return; }
1021 1012 if (val == 1) { gf_multby_one(src, dest, bytes, xor); return; }
... ... @@ -1147,7 +1138,6 @@ gf_w16_split_4_16_lazy_sse_altmap_multiply_region(gf_t *gf, void *src, void *des
1147 1138 uint8_t low[4][16];
1148 1139 uint8_t high[4][16];
1149 1140 gf_region_data rd;
1150   - struct gf_single_table_data *std;
1151 1141 __m128i mask, ta, tb, ti, tpl, tph, tlow[4], thigh[4];
1152 1142  
1153 1143 if (val == 0) { gf_multby_zero(dest, bytes, xor); return; }
... ... @@ -1358,11 +1348,8 @@ issse3 = 0;
1358 1348 static
1359 1349 int gf_w16_table_init(gf_t *gf)
1360 1350 {
1361   - gf_internal_t *h;
1362 1351 gf_w16_log_init(gf);
1363 1352  
1364   - h = (gf_internal_t *) gf->scratch;
1365   -
1366 1353 gf->multiply_region.w32 = gf_w16_table_lazy_multiply_region;
1367 1354 return 1;
1368 1355 }
... ... @@ -1557,15 +1544,14 @@ gf_w16_bytwo_p_nosse_multiply_region(gf_t *gf, void *src, void *dest, gf_val_32_
1557 1544 prod = _mm_xor_si128(prod, t1); \
1558 1545 v = _mm_srli_epi64(v, 1); }
1559 1546  
  1547 +#ifdef INTEL_SSE2
1560 1548 static
1561 1549 void
1562 1550 gf_w16_bytwo_p_sse_multiply_region(gf_t *gf, void *src, void *dest, gf_val_32_t val, int bytes, int xor)
1563 1551 {
1564   -#ifdef INTEL_SSE2
1565 1552 int i;
1566 1553 uint8_t *s8, *d8;
1567 1554 uint32_t vrev;
1568   - uint64_t amask;
1569 1555 __m128i pp, m1, m2, ta, prod, t1, t2, tp, one, v;
1570 1556 struct gf_w16_bytwo_data *btd;
1571 1557 gf_region_data rd;
... ... @@ -1618,17 +1604,16 @@ gf_w16_bytwo_p_sse_multiply_region(gf_t *gf, void *src, void *dest, gf_val_32_t
1618 1604 s8 += 16;
1619 1605 }
1620 1606 gf_do_final_region_alignment(&rd);
1621   -#endif
1622 1607 }
  1608 +#endif
1623 1609  
  1610 +#ifdef INTEL_SSE2
1624 1611 static
1625 1612 void
1626 1613 gf_w16_bytwo_b_sse_region_2_noxor(gf_region_data *rd, struct gf_w16_bytwo_data *btd)
1627 1614 {
1628   -#ifdef INTEL_SSE2
1629   - int i;
1630   - uint8_t *d8, *s8, tb;
1631   - __m128i pp, m1, m2, t1, t2, va, vb;
  1615 + uint8_t *d8, *s8;
  1616 + __m128i pp, m1, m2, t1, t2, va;
1632 1617  
1633 1618 s8 = (uint8_t *) rd->s_start;
1634 1619 d8 = (uint8_t *) rd->d_start;
... ... @@ -1644,16 +1629,15 @@ gf_w16_bytwo_b_sse_region_2_noxor(gf_region_data *rd, struct gf_w16_bytwo_data *
1644 1629 d8 += 16;
1645 1630 s8 += 16;
1646 1631 }
1647   -#endif
1648 1632 }
  1633 +#endif
1649 1634  
  1635 +#ifdef INTEL_SSE2
1650 1636 static
1651 1637 void
1652 1638 gf_w16_bytwo_b_sse_region_2_xor(gf_region_data *rd, struct gf_w16_bytwo_data *btd)
1653 1639 {
1654   -#ifdef INTEL_SSE2
1655   - int i;
1656