summaryrefslogtreecommitdiff
path: root/libguile/arrays.c
diff options
context:
space:
mode:
authorDaniel Llorens <lloda@sarc.name>2021-08-16 19:02:43 +0200
committerDaniel Llorens <lloda@sarc.name>2021-08-16 19:02:43 +0200
commit3df3ba1a2c956bba122328e1fc4be614171a4f42 (patch)
treed905779c2a31f7909ded18c46462afe65a68e353 /libguile/arrays.c
parentc60601332e8f328b014ac09ebd9b0e1c562f9238 (diff)
downloadguile-3df3ba1a2c956bba122328e1fc4be614171a4f42.tar.gz
Remove array contp flag
This flag was set, but never used in Guile, and there was no documented API to access it. To check if an array is contiguous, use (array-contents <> #t). * libguile/arrays.h (scm_i_raw_array): New function. SCM_I_ARRAY_CONTIGUOUS, SCM_SET_ARRAY_CONTIGUOUS_FLAG, SCM_CLR_ARRAY_CONTIGUOUS_FLAG, SCM_I_ARRAY_CONTP: Remove. scm_t_array_dim: Declare here, not in array-handle.h. SCM_I_ARRAY_NDIM: Shift by one bit since the contp flag isn't there anymore. * module/syste/vm/assembler.scm: Match removal of contp flag. * libguile/arrays.c (scm_i_make_array): Reuse scm_i_raw_array. (scm_i_ra_set_contp): Remove. (scm_transpose_array): Don't set or clear the contp flag. (scm_make_shared_array): Don't set or clear the contp flag. (scm_make_typed_array): Don't set the contp flag. * libguile/array-map.c (scm_i_array_rebase): Reuse scm_i_raw_array.
Diffstat (limited to 'libguile/arrays.c')
-rw-r--r--libguile/arrays.c33
1 files changed, 1 insertions, 32 deletions
diff --git a/libguile/arrays.c b/libguile/arrays.c
index f4eddd90a..924ee0094 100644
--- a/libguile/arrays.c
+++ b/libguile/arrays.c
@@ -52,7 +52,6 @@
#include "strings.h"
#include "uniform.h"
#include "vectors.h"
-#include "verify.h"
#include "arrays.h"
@@ -493,16 +492,11 @@ SCM_DEFINE (scm_shared_array_increments, "shared-array-increments", 1, 0, 0,
}
#undef FUNC_NAME
-/* FIXME: to avoid this assumption, fix the accessors in arrays.h,
- scm_i_make_array, and the array cases in system/vm/assembler.scm. */
-verify (sizeof (scm_t_array_dim) == 3*sizeof (scm_t_bits));
-
-/* Matching SCM_I_ARRAY accessors in arrays.h */
SCM
scm_i_make_array (int ndim)
{
- SCM ra = scm_words (((scm_t_bits) ndim << 17) + scm_tc7_array, 3 + ndim*3);
+ SCM ra = scm_i_raw_array (ndim);
SCM_I_ARRAY_SET_V (ra, SCM_BOOL_F);
SCM_I_ARRAY_SET_BASE (ra, 0);
/* dimensions are unset */
@@ -566,7 +560,6 @@ SCM_DEFINE (scm_make_typed_array, "make-typed-array", 2, 0, 1,
SCM ra;
ra = scm_i_shap2ra (bounds);
- SCM_SET_ARRAY_CONTIGUOUS_FLAG (ra);
s = SCM_I_ARRAY_DIMS (ra);
k = SCM_I_ARRAY_NDIM (ra);
@@ -600,28 +593,6 @@ SCM_DEFINE (scm_make_array, "make-array", 1, 0, 1,
}
#undef FUNC_NAME
-/* see scm_from_contiguous_array */
-static void
-scm_i_ra_set_contp (SCM ra)
-{
- size_t k = SCM_I_ARRAY_NDIM (ra);
- if (k)
- {
- ssize_t inc = SCM_I_ARRAY_DIMS (ra)[k - 1].inc;
- while (k--)
- {
- if (inc != SCM_I_ARRAY_DIMS (ra)[k].inc)
- {
- SCM_CLR_ARRAY_CONTIGUOUS_FLAG (ra);
- return;
- }
- inc *= (SCM_I_ARRAY_DIMS (ra)[k].ubnd
- - SCM_I_ARRAY_DIMS (ra)[k].lbnd + 1);
- }
- }
- SCM_SET_ARRAY_CONTIGUOUS_FLAG (ra);
-}
-
SCM_DEFINE (scm_make_shared_array, "make-shared-array", 2, 0, 1,
(SCM oldra, SCM mapfunc, SCM dims),
@@ -735,7 +706,6 @@ SCM_DEFINE (scm_make_shared_array, "make-shared-array", 2, 0, 1,
return scm_make_generalized_vector (scm_array_type (ra), SCM_INUM0,
SCM_UNDEFINED);
}
- scm_i_ra_set_contp (ra);
return ra;
}
#undef FUNC_NAME
@@ -1006,7 +976,6 @@ SCM_DEFINE (scm_transpose_array, "transpose-array", 1, 0, 1,
}
if (ndim > 0)
SCM_MISC_ERROR ("bad argument list", SCM_EOL);
- scm_i_ra_set_contp (res);
return res;
}
}