1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-07-04 00:30:30 +02:00

Fix rank-1 indirection in array-map.c

* array-map.c: (AREF, ASET): fix buggy indirection carried over
  from old generalized_vector-ref/set!.
This commit is contained in:
Daniel Llorens 2013-04-11 22:49:22 +02:00 committed by Andy Wingo
parent d848953d8c
commit 766f399d3b

View file

@ -54,7 +54,7 @@ AREF (SCM v, size_t pos)
scm_t_array_handle h; scm_t_array_handle h;
SCM ret; SCM ret;
scm_array_get_handle (v, &h); scm_array_get_handle (v, &h);
pos = h.base + h.dims[0].lbnd + pos * h.dims[0].inc; pos = h.base + (pos - h.dims[0].lbnd) * h.dims[0].inc;
ret = h.impl->vref (&h, pos); ret = h.impl->vref (&h, pos);
scm_array_handle_release (&h); scm_array_handle_release (&h);
return ret; return ret;
@ -65,7 +65,7 @@ ASET (SCM v, size_t pos, SCM val)
{ {
scm_t_array_handle h; scm_t_array_handle h;
scm_array_get_handle (v, &h); scm_array_get_handle (v, &h);
pos = h.base + h.dims[0].lbnd + pos * h.dims[0].inc; pos = h.base + (pos - h.dims[0].lbnd) * h.dims[0].inc;
h.impl->vset (&h, pos, val); h.impl->vset (&h, pos, val);
scm_array_handle_release (&h); scm_array_handle_release (&h);
} }