diff --git a/License.txt b/License.txt new file mode 100644 index 0000000..ec91080 --- /dev/null +++ b/License.txt @@ -0,0 +1,31 @@ +Copyright (c) 2013, James S. Plank, Kevin M. Greenan, Ethan L. Miller, William B. Houston +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of the University of Tennessee nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY +WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..91fecc5 --- /dev/null +++ b/README.txt @@ -0,0 +1,5 @@ +This is GF-Complete, Revision 0.1. + +Please see http://www.cs.utk.edu/~plank/plank/papers/CS-13-703.html for the user's +manual and other important documentation about this library, including more +recent revisions. diff --git a/gf_54.c b/gf_54.c index 4bcf81e..fc37783 100644 --- a/gf_54.c +++ b/gf_54.c @@ -11,8 +11,19 @@ main() { gf_t gf; + void *scratch; + int size; - gf_init_easy(&gf, 4); - printf("%d\n", gf.multiply.w32(&gf, 5, 4)); - exit(0); + size = gf_scratch_size(16, GF_MULT_SPLIT_TABLE, + GF_REGION_SSE | GF_REGION_ALTMAP, + GF_DIVIDE_DEFAULT, + 16, 4); + if (size == -1) exit(1); /* It failed. That shouldn't happen*/ + scratch = (void *) malloc(size); + if (scratch == NULL) { perror("malloc"); exit(1); } + if (!gf_init_hard(&gf, 16, GF_MULT_SPLIT_TABLE, + GF_REGION_SSE | GF_REGION_ALTMAP, + GF_DIVIDE_DEFAULT, + 0, 16, 4, NULL, scratch)) exit(1); + printf("Yo\n"); } diff --git a/gf_time.c b/gf_time.c index fb65aa2..7987dd7 100644 --- a/gf_time.c +++ b/gf_time.c @@ -59,6 +59,9 @@ void usage(char *s) fprintf(stderr, " D: Single: Divisions\n"); fprintf(stderr, " I: Single: Inverses\n"); fprintf(stderr, " G: Region: Buffer-Constant Multiplication\n"); + fprintf(stderr, " 0: Region: Doing nothing, and bzero()\n"); + fprintf(stderr, " 1: Region: Memcpy() and XOR\n"); + fprintf(stderr, " 2: Region: Multiplying by two\n"); fprintf(stderr, "\n"); fprintf(stderr, "Use -1 for time(0) as a seed.\n"); fprintf(stderr, "\n"); diff --git a/junk.c b/junk.c index 739a514..4bcf81e 100644 --- a/junk.c +++ b/junk.c @@ -1,17 +1,18 @@ +/* + * Multiplies four and five in GF(2^4). + */ + #include +#include +#include + +#include "gf_complete.h" main() { - int size, iterations; - double ds, di, elapsed; + gf_t gf; - elapsed = 0.614553; - size = 8192; - iterations = 655360; - - ds = size; - di = iterations; - - printf("%10.3lf\n", ((double) (size*iterations)) / (1024 * 1024 * elapsed)); - printf("%10.3lf\n", ds * di / 1024.0 / 1024.0 / elapsed); + gf_init_easy(&gf, 4); + printf("%d\n", gf.multiply.w32(&gf, 5, 4)); + exit(0); }