mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 14:48:47 +00:00
big: Update license to BSD-3.
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
@echo off
|
@echo off
|
||||||
:odin run . -vet -o:size
|
odin run . -vet -o:size
|
||||||
: -o:size
|
: -o:size
|
||||||
:odin build . -build-mode:shared -show-timings -o:minimal -no-bounds-check -define:MATH_BIG_EXE=false && python test.py -fast-tests
|
:odin build . -build-mode:shared -show-timings -o:minimal -no-bounds-check -define:MATH_BIG_EXE=false && python test.py -fast-tests
|
||||||
:odin build . -build-mode:shared -show-timings -o:size -no-bounds-check -define:MATH_BIG_EXE=false && python test.py -fast-tests
|
:odin build . -build-mode:shared -show-timings -o:size -no-bounds-check -define:MATH_BIG_EXE=false && python test.py -fast-tests
|
||||||
:odin build . -build-mode:shared -show-timings -o:size -define:MATH_BIG_EXE=false && python test.py -fast-tests
|
:odin build . -build-mode:shared -show-timings -o:size -define:MATH_BIG_EXE=false && python test.py -fast-tests
|
||||||
odin build . -build-mode:shared -show-timings -o:speed -no-bounds-check -define:MATH_BIG_EXE=false && python test.py
|
:odin build . -build-mode:shared -show-timings -o:speed -no-bounds-check -define:MATH_BIG_EXE=false && python test.py
|
||||||
: -fast-tests
|
: -fast-tests
|
||||||
:odin build . -build-mode:shared -show-timings -o:speed -define:MATH_BIG_EXE=false && python test.py -fast-tests
|
:odin build . -build-mode:shared -show-timings -o:speed -define:MATH_BIG_EXE=false && python test.py -fast-tests
|
||||||
@@ -2,7 +2,7 @@ package math_big
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2021 Jeroen van Rijn <nom@duclavier.com>.
|
Copyright 2021 Jeroen van Rijn <nom@duclavier.com>.
|
||||||
Made available under Odin's BSD-2 license.
|
Made available under Odin's BSD-3 license.
|
||||||
|
|
||||||
An arbitrary precision mathematics implementation in Odin.
|
An arbitrary precision mathematics implementation in Odin.
|
||||||
For the theoretical underpinnings, see Knuth's The Art of Computer Programming, Volume 2, section 4.3.
|
For the theoretical underpinnings, see Knuth's The Art of Computer Programming, Volume 2, section 4.3.
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package math_big
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2021 Jeroen van Rijn <nom@duclavier.com>.
|
Copyright 2021 Jeroen van Rijn <nom@duclavier.com>.
|
||||||
Made available under Odin's BSD-2 license.
|
Made available under Odin's BSD-3 license.
|
||||||
|
|
||||||
A BigInt implementation in Odin.
|
A BigInt implementation in Odin.
|
||||||
For the theoretical underpinnings, see Knuth's The Art of Computer Programming, Volume 2, section 4.3.
|
For the theoretical underpinnings, see Knuth's The Art of Computer Programming, Volume 2, section 4.3.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package math_big
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2021 Jeroen van Rijn <nom@duclavier.com>.
|
Copyright 2021 Jeroen van Rijn <nom@duclavier.com>.
|
||||||
Made available under Odin's BSD-2 license.
|
Made available under Odin's BSD-3 license.
|
||||||
|
|
||||||
An arbitrary precision mathematics implementation in Odin.
|
An arbitrary precision mathematics implementation in Odin.
|
||||||
For the theoretical underpinnings, see Knuth's The Art of Computer Programming, Volume 2, section 4.3.
|
For the theoretical underpinnings, see Knuth's The Art of Computer Programming, Volume 2, section 4.3.
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package math_big
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2021 Jeroen van Rijn <nom@duclavier.com>.
|
Copyright 2021 Jeroen van Rijn <nom@duclavier.com>.
|
||||||
Made available under Odin's BSD-2 license.
|
Made available under Odin's BSD-3 license.
|
||||||
|
|
||||||
A BigInt implementation in Odin.
|
A BigInt implementation in Odin.
|
||||||
For the theoretical underpinnings, see Knuth's The Art of Computer Programming, Volume 2, section 4.3.
|
For the theoretical underpinnings, see Knuth's The Art of Computer Programming, Volume 2, section 4.3.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package math_big
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2021 Jeroen van Rijn <nom@duclavier.com>.
|
Copyright 2021 Jeroen van Rijn <nom@duclavier.com>.
|
||||||
Made available under Odin's BSD-2 license.
|
Made available under Odin's BSD-3 license.
|
||||||
|
|
||||||
An arbitrary precision mathematics implementation in Odin.
|
An arbitrary precision mathematics implementation in Odin.
|
||||||
For the theoretical underpinnings, see Knuth's The Art of Computer Programming, Volume 2, section 4.3.
|
For the theoretical underpinnings, see Knuth's The Art of Computer Programming, Volume 2, section 4.3.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package math_big
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2021 Jeroen van Rijn <nom@duclavier.com>.
|
Copyright 2021 Jeroen van Rijn <nom@duclavier.com>.
|
||||||
Made available under Odin's BSD-2 license.
|
Made available under Odin's BSD-3 license.
|
||||||
|
|
||||||
An arbitrary precision mathematics implementation in Odin.
|
An arbitrary precision mathematics implementation in Odin.
|
||||||
For the theoretical underpinnings, see Knuth's The Art of Computer Programming, Volume 2, section 4.3.
|
For the theoretical underpinnings, see Knuth's The Art of Computer Programming, Volume 2, section 4.3.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package math_big
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2021 Jeroen van Rijn <nom@duclavier.com>.
|
Copyright 2021 Jeroen van Rijn <nom@duclavier.com>.
|
||||||
Made available under Odin's BSD-2 license.
|
Made available under Odin's BSD-3 license.
|
||||||
|
|
||||||
An arbitrary precision mathematics implementation in Odin.
|
An arbitrary precision mathematics implementation in Odin.
|
||||||
For the theoretical underpinnings, see Knuth's The Art of Computer Programming, Volume 2, section 4.3.
|
For the theoretical underpinnings, see Knuth's The Art of Computer Programming, Volume 2, section 4.3.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package math_big
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2021 Jeroen van Rijn <nom@duclavier.com>.
|
Copyright 2021 Jeroen van Rijn <nom@duclavier.com>.
|
||||||
Made available under Odin's BSD-2 license.
|
Made available under Odin's BSD-3 license.
|
||||||
|
|
||||||
An arbitrary precision mathematics implementation in Odin.
|
An arbitrary precision mathematics implementation in Odin.
|
||||||
For the theoretical underpinnings, see Knuth's The Art of Computer Programming, Volume 2, section 4.3.
|
For the theoretical underpinnings, see Knuth's The Art of Computer Programming, Volume 2, section 4.3.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package math_big
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2021 Jeroen van Rijn <nom@duclavier.com>.
|
Copyright 2021 Jeroen van Rijn <nom@duclavier.com>.
|
||||||
Made available under Odin's BSD-2 license.
|
Made available under Odin's BSD-3 license.
|
||||||
|
|
||||||
An arbitrary precision mathematics implementation in Odin.
|
An arbitrary precision mathematics implementation in Odin.
|
||||||
For the theoretical underpinnings, see Knuth's The Art of Computer Programming, Volume 2, section 4.3.
|
For the theoretical underpinnings, see Knuth's The Art of Computer Programming, Volume 2, section 4.3.
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package math_big
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2021 Jeroen van Rijn <nom@duclavier.com>.
|
Copyright 2021 Jeroen van Rijn <nom@duclavier.com>.
|
||||||
Made available under Odin's BSD-2 license.
|
Made available under Odin's BSD-3 license.
|
||||||
|
|
||||||
An arbitrary precision mathematics implementation in Odin.
|
An arbitrary precision mathematics implementation in Odin.
|
||||||
For the theoretical underpinnings, see Knuth's The Art of Computer Programming, Volume 2, section 4.3.
|
For the theoretical underpinnings, see Knuth's The Art of Computer Programming, Volume 2, section 4.3.
|
||||||
|
|||||||
+20
-20
@@ -14,6 +14,7 @@ parser = argparse.ArgumentParser(
|
|||||||
epilog = "By default we run regression and random tests with preset parameters.",
|
epilog = "By default we run regression and random tests with preset parameters.",
|
||||||
formatter_class = argparse.ArgumentDefaultsHelpFormatter,
|
formatter_class = argparse.ArgumentDefaultsHelpFormatter,
|
||||||
)
|
)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Normally, we report the number of passes and fails. With this option set, we exit at first fail.
|
# Normally, we report the number of passes and fails. With this option set, we exit at first fail.
|
||||||
#
|
#
|
||||||
@@ -22,10 +23,10 @@ parser.add_argument(
|
|||||||
help = "Exit when a test fails",
|
help = "Exit when a test fails",
|
||||||
action = "store_true",
|
action = "store_true",
|
||||||
)
|
)
|
||||||
|
|
||||||
#
|
#
|
||||||
# We skip randomized tests altogether if this is set.
|
# We skip randomized tests altogether if this is set.
|
||||||
#
|
#
|
||||||
|
|
||||||
no_random = parser.add_mutually_exclusive_group()
|
no_random = parser.add_mutually_exclusive_group()
|
||||||
|
|
||||||
no_random.add_argument(
|
no_random.add_argument(
|
||||||
@@ -33,13 +34,13 @@ no_random.add_argument(
|
|||||||
help = "No random tests",
|
help = "No random tests",
|
||||||
action = "store_true",
|
action = "store_true",
|
||||||
)
|
)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Normally we run a given number of cycles on each test.
|
# Normally we run a given number of cycles on each test.
|
||||||
# Timed tests budget 1 second per 20_000 bits instead.
|
# Timed tests budget 1 second per 20_000 bits instead.
|
||||||
#
|
#
|
||||||
# For timed tests we budget a second per `n` bits and iterate until we hit that time.
|
# For timed tests we budget a second per `n` bits and iterate until we hit that time.
|
||||||
#
|
#
|
||||||
|
|
||||||
timed_or_fast = no_random.add_mutually_exclusive_group()
|
timed_or_fast = no_random.add_mutually_exclusive_group()
|
||||||
|
|
||||||
timed_or_fast.add_argument(
|
timed_or_fast.add_argument(
|
||||||
@@ -55,6 +56,7 @@ parser.add_argument(
|
|||||||
default = 20_000,
|
default = 20_000,
|
||||||
help = "Timed tests. Every `BITS` worth of input is given a second of running time.",
|
help = "Timed tests. Every `BITS` worth of input is given a second of running time.",
|
||||||
)
|
)
|
||||||
|
|
||||||
#
|
#
|
||||||
# For normal tests (non-timed), `-fast-tests` cuts down on the number of iterations.
|
# For normal tests (non-timed), `-fast-tests` cuts down on the number of iterations.
|
||||||
#
|
#
|
||||||
@@ -136,7 +138,6 @@ gc.disable()
|
|||||||
#
|
#
|
||||||
# Set up exported procedures
|
# Set up exported procedures
|
||||||
#
|
#
|
||||||
|
|
||||||
try:
|
try:
|
||||||
l = cdll.LoadLibrary(LIB_PATH)
|
l = cdll.LoadLibrary(LIB_PATH)
|
||||||
except:
|
except:
|
||||||
@@ -159,29 +160,28 @@ print("initialize_constants: ", initialize_constants())
|
|||||||
|
|
||||||
error_string = load(l.test_error_string, [c_byte], c_char_p)
|
error_string = load(l.test_error_string, [c_byte], c_char_p)
|
||||||
|
|
||||||
add = load(l.test_add, [c_char_p, c_char_p], Res)
|
add = load(l.test_add, [c_char_p, c_char_p], Res)
|
||||||
sub = load(l.test_sub, [c_char_p, c_char_p], Res)
|
sub = load(l.test_sub, [c_char_p, c_char_p], Res)
|
||||||
mul = load(l.test_mul, [c_char_p, c_char_p], Res)
|
mul = load(l.test_mul, [c_char_p, c_char_p], Res)
|
||||||
sqr = load(l.test_sqr, [c_char_p ], Res)
|
sqr = load(l.test_sqr, [c_char_p ], Res)
|
||||||
div = load(l.test_div, [c_char_p, c_char_p], Res)
|
div = load(l.test_div, [c_char_p, c_char_p], Res)
|
||||||
|
|
||||||
# Powers and such
|
# Powers and such
|
||||||
int_log = load(l.test_log, [c_char_p, c_longlong], Res)
|
int_log = load(l.test_log, [c_char_p, c_longlong], Res)
|
||||||
int_pow = load(l.test_pow, [c_char_p, c_longlong], Res)
|
int_pow = load(l.test_pow, [c_char_p, c_longlong], Res)
|
||||||
int_sqrt = load(l.test_sqrt, [c_char_p ], Res)
|
int_sqrt = load(l.test_sqrt, [c_char_p ], Res)
|
||||||
int_root_n = load(l.test_root_n, [c_char_p, c_longlong], Res)
|
int_root_n = load(l.test_root_n, [c_char_p, c_longlong], Res)
|
||||||
|
|
||||||
# Logical operations
|
# Logical operations
|
||||||
|
int_shl_digit = load(l.test_shl_digit, [c_char_p, c_longlong], Res)
|
||||||
int_shl_digit = load(l.test_shl_digit, [c_char_p, c_longlong], Res)
|
int_shr_digit = load(l.test_shr_digit, [c_char_p, c_longlong], Res)
|
||||||
int_shr_digit = load(l.test_shr_digit, [c_char_p, c_longlong], Res)
|
int_shl = load(l.test_shl, [c_char_p, c_longlong], Res)
|
||||||
int_shl = load(l.test_shl, [c_char_p, c_longlong], Res)
|
int_shr = load(l.test_shr, [c_char_p, c_longlong], Res)
|
||||||
int_shr = load(l.test_shr, [c_char_p, c_longlong], Res)
|
|
||||||
int_shr_signed = load(l.test_shr_signed, [c_char_p, c_longlong], Res)
|
int_shr_signed = load(l.test_shr_signed, [c_char_p, c_longlong], Res)
|
||||||
|
|
||||||
int_factorial = load(l.test_factorial, [c_uint64], Res)
|
int_factorial = load(l.test_factorial, [c_uint64], Res)
|
||||||
int_gcd = load(l.test_gcd, [c_char_p, c_char_p], Res)
|
int_gcd = load(l.test_gcd, [c_char_p, c_char_p], Res)
|
||||||
int_lcm = load(l.test_lcm, [c_char_p, c_char_p], Res)
|
int_lcm = load(l.test_lcm, [c_char_p, c_char_p], Res)
|
||||||
|
|
||||||
def test(test_name: "", res: Res, param=[], expected_error = Error.Okay, expected_result = "", radix=16):
|
def test(test_name: "", res: Res, param=[], expected_error = Error.Okay, expected_result = "", radix=16):
|
||||||
passed = True
|
passed = True
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package math_big
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2021 Jeroen van Rijn <nom@duclavier.com>.
|
Copyright 2021 Jeroen van Rijn <nom@duclavier.com>.
|
||||||
Made available under Odin's BSD-2 license.
|
Made available under Odin's BSD-3 license.
|
||||||
|
|
||||||
A BigInt implementation in Odin.
|
A BigInt implementation in Odin.
|
||||||
For the theoretical underpinnings, see Knuth's The Art of Computer Programming, Volume 2, section 4.3.
|
For the theoretical underpinnings, see Knuth's The Art of Computer Programming, Volume 2, section 4.3.
|
||||||
|
|||||||
Reference in New Issue
Block a user