add Makefile and license
This commit is contained in:
12
LICENSE
Normal file
12
LICENSE
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
Copyright (c) 2023 John Regan
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
PERFORMANCE OF THIS SOFTWARE.
|
117
Makefile
Normal file
117
Makefile
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
.PHONY: all clean test
|
||||||
|
|
||||||
|
CFLAGS = -fPIC -g -O0 -Wall -Wextra
|
||||||
|
LDFLAGS =
|
||||||
|
|
||||||
|
all: utest-byte utest-short utest-word utest-quad \
|
||||||
|
utest-byte-static utest-short-static utest-word-static utest-quad-static \
|
||||||
|
utest-byte-single utest-short-single utest-word-single utest-quad-single \
|
||||||
|
utest-coverage bigint.o
|
||||||
|
|
||||||
|
test: utest-byte utest-short utest-word utest-quad utest-byte-single utest-short-single utest-word-single utest-quad-single utest-coverage
|
||||||
|
./utest-byte >/dev/null 2>&1 || ./utest-byte
|
||||||
|
./utest-short >/dev/null 2>&1 || ./utest-short
|
||||||
|
./utest-word >/dev/null 2>&1 || ./utest-word
|
||||||
|
./utest-quad >/dev/null 2>&1 || ./utest-quad
|
||||||
|
./utest-byte-single >/dev/null 2>&1 || ./utest-byte-single
|
||||||
|
./utest-short-single >/dev/null 2>&1 || ./utest-short-single
|
||||||
|
./utest-word-single >/dev/null 2>&1 || ./utest-word-single
|
||||||
|
./utest-quad-single >/dev/null 2>&1 || ./utest-quad-single
|
||||||
|
./utest-byte-static >/dev/null 2>&1 || ./utest-byte-static
|
||||||
|
./utest-short-static >/dev/null 2>&1 || ./utest-short-static
|
||||||
|
./utest-word-static >/dev/null 2>&1 || ./utest-word-static
|
||||||
|
./utest-quad-static >/dev/null 2>&1 || ./utest-quad-static
|
||||||
|
mkdir -p coverage
|
||||||
|
rm -f coverage/*
|
||||||
|
./utest-coverage
|
||||||
|
gcovr --html-details --output coverage/index.html
|
||||||
|
rm -f *.gcda
|
||||||
|
rm -f *.gcno
|
||||||
|
|
||||||
|
utest-byte: utest-byte.o
|
||||||
|
$(CC) -o $@ $^ $(LDFLAGS)
|
||||||
|
|
||||||
|
utest-short: utest-short.o
|
||||||
|
$(CC) -o $@ $^ $(LDFLAGS)
|
||||||
|
|
||||||
|
utest-word: utest-word.o
|
||||||
|
$(CC) -o $@ $^ $(LDFLAGS)
|
||||||
|
|
||||||
|
utest-quad: utest-quad.o
|
||||||
|
$(CC) -o $@ $^ $(LDFLAGS)
|
||||||
|
|
||||||
|
utest-byte-single: utest-byte-single.o
|
||||||
|
$(CC) -o $@ $^ $(LDFLAGS)
|
||||||
|
|
||||||
|
utest-short-single: utest-short-single.o
|
||||||
|
$(CC) -o $@ $^ $(LDFLAGS)
|
||||||
|
|
||||||
|
utest-word-single: utest-word-single.o
|
||||||
|
$(CC) -o $@ $^ $(LDFLAGS)
|
||||||
|
|
||||||
|
utest-quad-single: utest-quad-single.o
|
||||||
|
$(CC) -o $@ $^ $(LDFLAGS)
|
||||||
|
|
||||||
|
utest-byte-static: utest-byte-static.o
|
||||||
|
$(CC) -o $@ $^ $(LDFLAGS)
|
||||||
|
|
||||||
|
utest-short-static: utest-short-static.o
|
||||||
|
$(CC) -o $@ $^ $(LDFLAGS)
|
||||||
|
|
||||||
|
utest-word-static: utest-word-static.o
|
||||||
|
$(CC) -o $@ $^ $(LDFLAGS)
|
||||||
|
|
||||||
|
utest-quad-static: utest-quad-static.o
|
||||||
|
$(CC) -o $@ $^ $(LDFLAGS)
|
||||||
|
|
||||||
|
utest-coverage: utest-coverage.o
|
||||||
|
$(CC) -o $@ $^ $(LDFLAGS) --coverage
|
||||||
|
|
||||||
|
utest-byte.o: utest.c utest.h bigint.h
|
||||||
|
$(CC) $(CFLAGS) -DBIGINT_WORD_WIDTH=1 -c -o $@ $<
|
||||||
|
|
||||||
|
utest-short.o: utest.c utest.h bigint.h
|
||||||
|
$(CC) $(CFLAGS) -DBIGINT_WORD_WIDTH=2 -c -o $@ $<
|
||||||
|
|
||||||
|
utest-word.o: utest.c utest.h bigint.h
|
||||||
|
$(CC) $(CFLAGS) -DBIGINT_WORD_WIDTH=4 -c -o $@ $<
|
||||||
|
|
||||||
|
utest-quad.o: utest.c utest.h bigint.h
|
||||||
|
$(CC) $(CFLAGS) -DBIGINT_WORD_WIDTH=8 -c -o $@ $<
|
||||||
|
|
||||||
|
utest-byte-single.o: utest.c utest.h bigint.h
|
||||||
|
$(CC) $(CFLAGS) -DBIGINT_SINGLE_WORD_ONLY -DBIGINT_WORD_WIDTH=1 -c -o $@ $<
|
||||||
|
|
||||||
|
utest-short-single.o: utest.c utest.h bigint.h
|
||||||
|
$(CC) $(CFLAGS) -DBIGINT_SINGLE_WORD_ONLY -DBIGINT_WORD_WIDTH=2 -c -o $@ $<
|
||||||
|
|
||||||
|
utest-word-single.o: utest.c utest.h bigint.h
|
||||||
|
$(CC) $(CFLAGS) -DBIGINT_SINGLE_WORD_ONLY -DBIGINT_WORD_WIDTH=4 -c -o $@ $<
|
||||||
|
|
||||||
|
utest-quad-single.o: utest.c utest.h bigint.h
|
||||||
|
$(CC) $(CFLAGS) -DBIGINT_SINGLE_WORD_ONLY -DBIGINT_WORD_WIDTH=8 -c -o $@ $<
|
||||||
|
|
||||||
|
utest-byte-static.o: utest.c utest.h bigint.h
|
||||||
|
$(CC) $(CFLAGS) -DBIGINT_NO_MALLOC -DBIGINT_WORD_WIDTH=1 -c -o $@ $<
|
||||||
|
|
||||||
|
utest-short-static.o: utest.c utest.h bigint.h
|
||||||
|
$(CC) $(CFLAGS) -DBIGINT_NO_MALLOC -DBIGINT_WORD_WIDTH=2 -c -o $@ $<
|
||||||
|
|
||||||
|
utest-word-static.o: utest.c utest.h bigint.h
|
||||||
|
$(CC) $(CFLAGS) -DBIGINT_NO_MALLOC -DBIGINT_WORD_WIDTH=4 -c -o $@ $<
|
||||||
|
|
||||||
|
utest-quad-static.o: utest.c utest.h bigint.h
|
||||||
|
$(CC) $(CFLAGS) -DBIGINT_NO_MALLOC -DBIGINT_WORD_WIDTH=8 -c -o $@ $<
|
||||||
|
|
||||||
|
utest-coverage.o: utest.c utest.h bigint.h
|
||||||
|
$(CC) $(CFLAGS) --coverage -c -o $@ $<
|
||||||
|
|
||||||
|
bigint.o: bigint.h
|
||||||
|
$(CC) -DBIGINT_IMPLEMENTATION -std=c99 -pedantic $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o *.exe
|
||||||
|
rm -f utest-coverage
|
||||||
|
rm -f utest-byte utest-short utest-word utest-quad
|
||||||
|
rm -f utest-byte-single utest-short-single utest-word-single utest-quad-single
|
||||||
|
rm -f utest-byte-static utest-short-static utest-word-static utest-quad-static
|
15
bigint.h
15
bigint.h
@@ -1,6 +1,21 @@
|
|||||||
#ifndef BIGINTH
|
#ifndef BIGINTH
|
||||||
#define BIGINTH
|
#define BIGINTH
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright (c) 2023 John Regan
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
#if !defined(BIGINT_API)
|
#if !defined(BIGINT_API)
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define BIGINT_DLL_IMPORT __declspec(dllimport)
|
#define BIGINT_DLL_IMPORT __declspec(dllimport)
|
||||||
|
Reference in New Issue
Block a user