aboutsummaryrefslogtreecommitdiff
path: root/core/math/big/common.odin
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2025-11-27 09:10:03 +0000
committergingerBill <gingerBill@users.noreply.github.com>2025-11-27 09:10:03 +0000
commit53876907c61faaadf68ae8b8140ed55df3f691d3 (patch)
tree5b68b4e4a1ce2d8da9ad82985a9c795f5a05d911 /core/math/big/common.odin
parent49634246c5853dceb770161bea3742b9171b7a0f (diff)
Handle `Allocator_Error` correctly in `core:math/big`
Diffstat (limited to 'core/math/big/common.odin')
-rw-r--r--core/math/big/common.odin12
1 files changed, 9 insertions, 3 deletions
diff --git a/core/math/big/common.odin b/core/math/big/common.odin
index a1eb4a7fd..cebe25119 100644
--- a/core/math/big/common.odin
+++ b/core/math/big/common.odin
@@ -6,6 +6,7 @@ package math_big
*/
import "base:intrinsics"
+import "base:runtime"
/*
TODO: Make the tunables runtime adjustable where practical.
@@ -138,11 +139,12 @@ Flags :: bit_set[Flag; u8]
/*
Errors are a strict superset of runtime.Allocation_Error.
*/
-Error :: enum int {
- Okay = 0,
+Error :: enum byte {
+ None = 0,
Out_Of_Memory = 1,
Invalid_Pointer = 2,
Invalid_Argument = 3,
+ Mode_Not_Implemented = 4, // Allocation
Assignment_To_Immutable = 10,
Max_Iterations_Reached = 11,
@@ -160,11 +162,15 @@ Error :: enum int {
Unimplemented = 127,
}
+#assert(intrinsics.type_is_superset_of(Error, runtime.Allocator_Error))
+
+
Error_String :: #sparse[Error]string{
- .Okay = "Okay",
+ .None = "None",
.Out_Of_Memory = "Out of memory",
.Invalid_Pointer = "Invalid pointer",
.Invalid_Argument = "Invalid argument",
+ .Mode_Not_Implemented = "Allocation mode not implemented",
.Assignment_To_Immutable = "Assignment to immutable",
.Max_Iterations_Reached = "Max iterations reached",