[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 23/27: Remove 'contiguous' flag in arrays
From: |
Daniel Llorens |
Subject: |
[Guile-commits] 23/27: Remove 'contiguous' flag in arrays |
Date: |
Tue, 10 Mar 2020 05:23:32 -0400 (EDT) |
lloda pushed a commit to branch wip-vector-cleanup
in repository guile.
commit 4e0b03829db0e3bfbd3e3ed3f775c34ff9530754
Author: Daniel Llorens <address@hidden>
AuthorDate: Fri Feb 7 15:43:24 2020 +0100
Remove 'contiguous' flag in arrays
Was never used, so we save having to set it on various ops.
* libguile/arrays.h (SCM_I_ARRAY_FLAG_CONTIGUOUS,
SCM_SET_ARRAY_CONTIGUOUS_FLAG, SCM_CLR_ARRAY_CONTIGUOUS_FLAG,
SCM_I_ARRAY_CONTP): Remove.
* libguile/arrays.c (scm_i_ra_set_contp): Remove. Elsewhere remove all
uses of this and the other macros.
---
NEWS-wip-vector-cleanup.txt | 5 +++++
libguile/arrays.c | 26 --------------------------
libguile/arrays.h | 8 --------
3 files changed, 5 insertions(+), 34 deletions(-)
diff --git a/NEWS-wip-vector-cleanup.txt b/NEWS-wip-vector-cleanup.txt
index 84b5c7a..e7e4ea1 100644
--- a/NEWS-wip-vector-cleanup.txt
+++ b/NEWS-wip-vector-cleanup.txt
@@ -19,6 +19,11 @@ Use scm_is_vector instead.
If you were including these headers directly for any reason, just include
libguile.h instead.
+** scm_from_contiguous_typed_array has been removed.
+
+This function was undocumented. Instead, use scm_make_typed_array and
+the array handle functions to copy data to the new array.
+
* Backward incompatible changes
diff --git a/libguile/arrays.c b/libguile/arrays.c
index 95bc6e1..e6af629 100644
--- a/libguile/arrays.c
+++ b/libguile/arrays.c
@@ -604,7 +604,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);
@@ -637,29 +636,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),
"@code{make-shared-array} can be used to create shared subarrays\n"
@@ -772,7 +748,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
@@ -1043,7 +1018,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;
}
}
diff --git a/libguile/arrays.h b/libguile/arrays.h
index 0d2f334..0d2eae2 100644
--- a/libguile/arrays.h
+++ b/libguile/arrays.h
@@ -89,16 +89,8 @@ SCM_API SCM scm_array_rank (SCM ra);
/* internal. */
-/* 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)))
-
#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_V(a) SCM_CELL_OBJECT_1 (a)
#define SCM_I_ARRAY_BASE(a) ((size_t) SCM_CELL_WORD_2 (a))
- [Guile-commits] 18/27: Pull generalized-vectors from under bytevectors, (continued)
- [Guile-commits] 18/27: Pull generalized-vectors from under bytevectors, Daniel Llorens, 2020/03/10
- [Guile-commits] 19/27: Remove generalized-vectors.[hc], Daniel Llorens, 2020/03/10
- [Guile-commits] 11/27: Add lenp parameter back to scm_bitvector_(writable_)elements, Daniel Llorens, 2020/03/10
- [Guile-commits] 13/27: Move bitvector functions using array_handle to libguile/array-handle.[ch], Daniel Llorens, 2020/03/10
- [Guile-commits] 15/27: Rewrite vector-copy! using memmove, Daniel Llorens, 2020/03/10
- [Guile-commits] 20/27: Update branch news file, Daniel Llorens, 2020/03/10
- [Guile-commits] 05/27: Simple vectors are just vectors, Daniel Llorens, 2020/03/10
- [Guile-commits] 27/27: Reuse SCM_ASSERT_RANGE in scm_c_vector_ref, scm_c_vector_set_x, Daniel Llorens, 2020/03/10
- [Guile-commits] 25/27: Remove superfluous type check in bitvector->list, Daniel Llorens, 2020/03/10
- [Guile-commits] 17/27: Pull generalized-vectors from under typed vectors, Daniel Llorens, 2020/03/10
- [Guile-commits] 23/27: Remove 'contiguous' flag in arrays,
Daniel Llorens <=
- [Guile-commits] 14/27: Golf in srfi-4.h, Daniel Llorens, 2020/03/10
- [Guile-commits] 07/27: Simplify interfaces to scm_bitvector_elements and scm_bitvector_writable_elements, Daniel Llorens, 2020/03/10
- [Guile-commits] 22/27: Remove scm_from_contiguous_typed_array, Daniel Llorens, 2020/03/10
- [Guile-commits] 26/27: Simplify vector constructor, Daniel Llorens, 2020/03/10
- [Guile-commits] 24/27: Move uniform-array->bytevector from (rnrs bytevectors) to core, Daniel Llorens, 2020/03/10
- [Guile-commits] 21/27: Merge generalized-arrays.[ch] in arrays.[ch], Daniel Llorens, 2020/03/10