aboutsummaryrefslogtreecommitdiff
path: root/core/math/big/example.odin
diff options
context:
space:
mode:
authorJeroen van Rijn <Kelimion@users.noreply.github.com>2021-08-03 17:07:25 +0200
committerJeroen van Rijn <Kelimion@users.noreply.github.com>2021-08-11 20:59:52 +0200
commit97d80d03f9902872bcd12e460822dce70e6d3fd1 (patch)
treeb0c9a0e85d238df5dc4ee8b5a390a15719c17fb1 /core/math/big/example.odin
parent627872db979585d70c0e19811345e440e253ce88 (diff)
big: `Error.None` -> `nil`
Diffstat (limited to 'core/math/big/example.odin')
-rw-r--r--core/math/big/example.odin11
1 files changed, 7 insertions, 4 deletions
diff --git a/core/math/big/example.odin b/core/math/big/example.odin
index 7c2df9303..7dc6329c6 100644
--- a/core/math/big/example.odin
+++ b/core/math/big/example.odin
@@ -102,7 +102,7 @@ print :: proc(name: string, a: ^Int, base := i8(10), print_name := false, newlin
} else {
fmt.printf("%v", as);
}
- if err != .None {
+ if err != nil {
fmt.printf("%v (error: %v | %v)", name, err, a);
}
if newline {
@@ -118,19 +118,22 @@ demo :: proc() {
a, b, c, d, e, f := &Int{}, &Int{}, &Int{}, &Int{}, &Int{}, &Int{};
defer destroy(a, b, c, d, e, f);
- N :: 5_000;
+ factorial(a, 128); // Untimed warmup.
+
+ N :: 128;
s := time.tick_now();
err = factorial(a, N);
Timings[.factorial].t += time.tick_since(s); Timings[.factorial].c += 1;
- if err != .None {
+
+ if err != nil {
fmt.printf("factorial(%v) returned %v\n", N, err);
}
s = time.tick_now();
as, err = itoa(a, 16);
Timings[.itoa].t += time.tick_since(s); Timings[.itoa].c += 1;
- if err != .None {
+ if err != nil {
fmt.printf("itoa(factorial(%v), 16) returned %v\n", N, err);
}