Commit 4bec6e51d04836645778ef636f01678b2a6e65cb

Thomas de Grivel 2023-09-23T09:03:03

wip integer arrays

diff --git a/lib/c3/0.1/integer.facts b/lib/c3/0.1/integer.facts
index 080ce8a..c149de8 100644
--- a/lib/c3/0.1/integer.facts
+++ b/lib/c3/0.1/integer.facts
@@ -2,4 +2,4 @@
   version: 1}
 add {Integer, :is_a, :module}
 add {Integer, :symbol, Integer.cast}
-replace {Integer.cast, :cfn, cfn :integer "integer_cast" (:tag)}
+replace {Integer.cast, :cfn, cfn :integer "integer_cast" (:tag, :&result)}
diff --git a/libc3/integer.c b/libc3/integer.c
index 2785681..ee02546 100644
--- a/libc3/integer.c
+++ b/libc3/integer.c
@@ -227,14 +227,14 @@ s_integer * integer_init_1 (s_integer *i, const s8 *p)
   return i;
 }
 
-s_integer * integer_init_copy (s_integer *i, const s_integer *a)
+s_integer * integer_init_copy (s_integer *a, const s_integer *src)
 {
   sw r;
   assert(a);
-  assert(i);
-  if ((r = mp_init_copy(&i->mp_int, &a->mp_int)) != MP_OKAY)
+  assert(src);
+  if ((r = mp_init_copy(&a->mp_int, &src->mp_int)) != MP_OKAY)
     errx(1, "integer_init_copy: %s", mp_error_to_string(r));
-  return i;
+  return a;
 }
 
 s_integer * integer_init_f64 (s_integer *a, f64 x)
diff --git a/libc3/integer.h b/libc3/integer.h
index f21c2e0..151509d 100644
--- a/libc3/integer.h
+++ b/libc3/integer.h
@@ -28,7 +28,7 @@
 /* Stack allocation compatible functions */
 s_integer * integer_init (s_integer *i);
 s_integer * integer_init_1 (s_integer *i, const s8 *p);
-s_integer * integer_init_copy (s_integer *i, const s_integer *x);
+s_integer * integer_init_copy (s_integer *a, const s_integer *x);
 s_integer * integer_init_f32 (s_integer *a, f32 x);
 s_integer * integer_init_f64 (s_integer *a, f64 x);
 s_integer * integer_init_s8 (s_integer *a, s8 x);