mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
big: Fix signed multiplication for some inputs.
This commit is contained in:
@@ -1,9 +1,8 @@
|
|||||||
@echo off
|
@echo off
|
||||||
:odin run . -vet -o:speed -no-bounds-check
|
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
|
||||||
File diff suppressed because one or more lines are too long
@@ -630,6 +630,8 @@ internal_int_mul :: proc(dest, src, multiplier: ^Int, allocator := context.alloc
|
|||||||
*/
|
*/
|
||||||
if multiplier.used == 0 || src.used == 0 { return internal_zero(dest); }
|
if multiplier.used == 0 || src.used == 0 { return internal_zero(dest); }
|
||||||
|
|
||||||
|
neg := src.sign != multiplier.sign;
|
||||||
|
|
||||||
if src == multiplier {
|
if src == multiplier {
|
||||||
/*
|
/*
|
||||||
Do we need to square?
|
Do we need to square?
|
||||||
@@ -694,7 +696,7 @@ internal_int_mul :: proc(dest, src, multiplier: ^Int, allocator := context.alloc
|
|||||||
err = #force_inline _private_int_mul(dest, src, multiplier, digits);
|
err = #force_inline _private_int_mul(dest, src, multiplier, digits);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
neg := src.sign != multiplier.sign;
|
|
||||||
dest.sign = .Negative if dest.used > 0 && neg else .Zero_or_Positive;
|
dest.sign = .Negative if dest.used > 0 && neg else .Zero_or_Positive;
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -161,6 +161,7 @@ _private_int_mul_toom :: proc(dest, a, b: ^Int, allocator := context.allocator)
|
|||||||
internal_clamp(b1);
|
internal_clamp(b1);
|
||||||
internal_clamp(b2);
|
internal_clamp(b2);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
\\ S1 = (a2+a1+a0) * (b2+b1+b0);
|
\\ S1 = (a2+a1+a0) * (b2+b1+b0);
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user