1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-07-03 08:10:31 +02:00

Inline generalized-vector calls in array_handle_ref/set

* libguile/arrays.c: (array-handle-ref, array-handle-set): Ditto.
This commit is contained in:
Daniel Llorens 2013-04-18 15:12:09 +02:00 committed by Andy Wingo
parent 233fd7c360
commit 07f4a9151e

View file

@ -817,15 +817,25 @@ scm_i_print_array (SCM array, SCM port, scm_print_state *pstate)
} }
static SCM static SCM
array_handle_ref (scm_t_array_handle *h, size_t pos) array_handle_ref (scm_t_array_handle *hh, size_t pos)
{ {
return scm_c_generalized_vector_ref (SCM_I_ARRAY_V (h->array), pos); scm_t_array_handle h;
SCM ret;
scm_array_get_handle (SCM_I_ARRAY_V (hh->array), &h);
pos = h.base + h.dims[0].lbnd + pos * h.dims[0].inc;
ret = h.impl->vref (&h, pos);
scm_array_handle_release (&h);
return ret;
} }
static void static void
array_handle_set (scm_t_array_handle *h, size_t pos, SCM val) array_handle_set (scm_t_array_handle *hh, size_t pos, SCM val)
{ {
scm_c_generalized_vector_set_x (SCM_I_ARRAY_V (h->array), pos, val); scm_t_array_handle h;
scm_array_get_handle (SCM_I_ARRAY_V (hh->array), &h);
pos = h.base + h.dims[0].lbnd + pos * h.dims[0].inc;
h.impl->vset (&h, pos, val);
scm_array_handle_release (&h);
} }
/* FIXME: should be handle for vect? maybe not, because of dims */ /* FIXME: should be handle for vect? maybe not, because of dims */