summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Llorens <daniel.llorens@bluewin.ch>2013-04-11 22:49:22 +0200
committerAndy Wingo <wingo@pobox.com>2014-01-27 21:45:18 +0100
commit766f399d3b1a93e5c53768e5033de225b21aa6e1 (patch)
tree64d871d9c9c74d7ab45da5b58054f3a4cc739887
parentd848953d8c00209b617e692e044fe7dec39fd128 (diff)
downloadguile-766f399d3b1a93e5c53768e5033de225b21aa6e1.tar.gz
Fix rank-1 indirection in array-map.c
* array-map.c: (AREF, ASET): fix buggy indirection carried over from old generalized_vector-ref/set!.
-rw-r--r--libguile/array-map.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libguile/array-map.c b/libguile/array-map.c
index 6d8d25fe0..2d6a2e71d 100644
--- a/libguile/array-map.c
+++ b/libguile/array-map.c
@@ -54,7 +54,7 @@ AREF (SCM v, size_t pos)
scm_t_array_handle h;
SCM ret;
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);
scm_array_handle_release (&h);
return ret;
@@ -65,7 +65,7 @@ ASET (SCM v, size_t pos, SCM val)
{
scm_t_array_handle 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);
scm_array_handle_release (&h);
}