diff options
author | Daniel Llorens <lloda@sarc.name> | 2021-08-16 19:02:43 +0200 |
---|---|---|
committer | Daniel Llorens <lloda@sarc.name> | 2021-08-16 19:02:43 +0200 |
commit | 3df3ba1a2c956bba122328e1fc4be614171a4f42 (patch) | |
tree | d905779c2a31f7909ded18c46462afe65a68e353 /libguile/arrays.h | |
parent | c60601332e8f328b014ac09ebd9b0e1c562f9238 (diff) | |
download | guile-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.h')
-rw-r--r-- | libguile/arrays.h | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/libguile/arrays.h b/libguile/arrays.h index 494645d72..e427eab20 100644 --- a/libguile/arrays.h +++ b/libguile/arrays.h @@ -23,7 +23,6 @@ #include "libguile/print.h" -#include "libguile/array-handle.h" @@ -85,26 +84,31 @@ SCM_API SCM scm_array_ref (SCM v, SCM args); SCM_API SCM scm_array_set_x (SCM v, SCM obj, SCM args); SCM_API SCM scm_array_to_list (SCM v); -/* internal. */ +typedef struct scm_t_array_dim +{ + ssize_t lbnd; + ssize_t ubnd; + ssize_t inc; +} scm_t_array_dim; -/* see scm_from_contiguous_array for these three */ -#define SCM_I_ARRAY_FLAG_CONTIGUOUS (1 << 0) -#define SCM_SET_ARRAY_CONTIGUOUS_FLAG(x) \ - (SCM_SET_CELL_WORD_0 ((x), SCM_CELL_WORD_0 (x) | (SCM_I_ARRAY_FLAG_CONTIGUOUS << 16))) -#define SCM_CLR_ARRAY_CONTIGUOUS_FLAG(x) \ - (SCM_SET_CELL_WORD_0 ((x), SCM_CELL_WORD_0 (x) & ~(SCM_I_ARRAY_FLAG_CONTIGUOUS << 16))) +/* internal. */ #define SCM_I_ARRAYP(a) SCM_TYP16_PREDICATE (scm_tc7_array, a) -#define SCM_I_ARRAY_NDIM(x) ((size_t) (SCM_CELL_WORD_0 (x)>>17)) -#define SCM_I_ARRAY_CONTP(x) (SCM_CELL_WORD_0 (x) & (SCM_I_ARRAY_FLAG_CONTIGUOUS << 16)) - +#define SCM_I_ARRAY_NDIM(x) ((size_t) (SCM_CELL_WORD_0 (x)>>16)) #define SCM_I_ARRAY_V(a) SCM_CELL_OBJECT_1 (a) #define SCM_I_ARRAY_BASE(a) ((size_t) SCM_CELL_WORD_2 (a)) #define SCM_I_ARRAY_DIMS(a) ((scm_t_array_dim *) SCM_CELL_OBJECT_LOC (a, 3)) - #define SCM_I_ARRAY_SET_V(a, v) SCM_SET_CELL_OBJECT_1(a, v) #define SCM_I_ARRAY_SET_BASE(a, base) SCM_SET_CELL_WORD_2(a, base) +/* See the array cases in system/vm/assembler.scm. */ + +static inline SCM +scm_i_raw_array (int ndim) +{ + return scm_words (((scm_t_bits) ndim << 16) + scm_tc7_array, 3 + ndim*3); +} + SCM_INTERNAL SCM scm_i_make_array (int ndim); SCM_INTERNAL int scm_i_print_array (SCM array, SCM port, scm_print_state *pstate); SCM_INTERNAL SCM scm_i_shap2ra (SCM args); |