aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2024-03-13 15:12:19 +0000
committergingerBill <bill@gingerbill.org>2024-03-13 15:12:19 +0000
commit4aec2de7bd186bbdfe9aa0f890f9a276480c80c2 (patch)
tree7ace46f2786a6a823e12358d53988392593617cb
parentac10f504e467053861fcf00b86bbb2904ddadafe (diff)
parentd62c92f5a9891267e6ee2c121085815ce6734cf6 (diff)
Merge branch 'master' of https://github.com/odin-lang/Odin
-rw-r--r--core/math/big/internal.odin1
-rw-r--r--core/math/big/prime.odin7
-rw-r--r--src/check_expr.cpp4
-rw-r--r--src/path.cpp2
4 files changed, 9 insertions, 5 deletions
diff --git a/core/math/big/internal.odin b/core/math/big/internal.odin
index 03623e7f2..07e1e6c03 100644
--- a/core/math/big/internal.odin
+++ b/core/math/big/internal.odin
@@ -2047,6 +2047,7 @@ internal_int_inverse_modulo :: proc(dest, a, b: ^Int, allocator := context.alloc
return _private_inverse_modulo(dest, a, b)
}
+internal_int_invmod :: internal_int_inverse_modulo
internal_invmod :: proc{ internal_int_inverse_modulo, }
/*
diff --git a/core/math/big/prime.odin b/core/math/big/prime.odin
index 110c10239..cb0b08dbb 100644
--- a/core/math/big/prime.odin
+++ b/core/math/big/prime.odin
@@ -44,7 +44,7 @@ internal_int_prime_is_divisible :: proc(a: ^Int, allocator := context.allocator)
Computes res == G**X mod P.
Assumes `res`, `G`, `X` and `P` to not be `nil` and for `G`, `X` and `P` to have been initialized.
*/
-internal_int_exponent_mod :: proc(res, G, X, P: ^Int, allocator := context.allocator) -> (err: Error) {
+internal_int_power_modulo :: proc(res, G, X, P: ^Int, allocator := context.allocator) -> (err: Error) {
context.allocator = allocator
dr: int
@@ -112,6 +112,9 @@ internal_int_exponent_mod :: proc(res, G, X, P: ^Int, allocator := context.alloc
*/
return _private_int_exponent_mod(res, G, X, P, 0)
}
+internal_int_exponent_mod :: internal_int_power_modulo
+internal_int_powmod :: internal_int_power_modulo
+internal_powmod :: proc { internal_int_power_modulo, }
/*
Kronecker/Legendre symbol (a|p)
@@ -1411,4 +1414,4 @@ number_of_rabin_miller_trials :: proc(bit_size: int) -> (number_of_trials: int)
case:
return 2 /* For keysizes bigger than 10_240 use always at least 2 Rounds */
}
-} \ No newline at end of file
+}
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index 0911e48cf..1e4c7499b 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -6796,7 +6796,7 @@ gb_internal CallArgumentError check_polymorphic_record_type(CheckerContext *c, O
isize index = lookup_polymorphic_record_parameter(original_type, name);
if (index >= 0) {
TypeTuple *params = get_record_polymorphic_params(original_type);
- Entity *e = params->variables[i];
+ Entity *e = params->variables[index];
if (e->kind == Entity_Constant) {
check_expr_with_type_hint(c, &operands[i], fv->value, e->type);
continue;
@@ -6847,7 +6847,7 @@ gb_internal CallArgumentError check_polymorphic_record_type(CheckerContext *c, O
Array<Operand> ordered_operands = operands;
if (!named_fields) {
- ordered_operands = array_make<Operand>(permanent_allocator(), param_count);
+ ordered_operands = array_make<Operand>(permanent_allocator(), operands.count);
array_copy(&ordered_operands, operands, 0);
} else {
TEMPORARY_ALLOCATOR_GUARD();
diff --git a/src/path.cpp b/src/path.cpp
index 742bba7f8..b07f20870 100644
--- a/src/path.cpp
+++ b/src/path.cpp
@@ -407,7 +407,7 @@ gb_internal ReadDirectoryError read_directory(String path, Array<FileInfo> *fi)
i64 size = dir_stat.st_size;
FileInfo info = {};
- info.name = name;
+ info.name = copy_string(a, name);
info.fullpath = path_to_full_path(a, filepath);
info.size = size;
array_add(fi, info);