mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-02 21:10:27 +02:00
Don't use ASET in scm_array_index_map_x
* libguile/array-map.c: (scm_array_index_map_x): replace ASET by direct use of handle->impl.
This commit is contained in:
parent
ce6fce6af3
commit
86263a20cd
1 changed files with 5 additions and 5 deletions
|
@ -715,6 +715,7 @@ SCM_DEFINE (scm_array_index_map_x, "array-index-map!", 2, 0, 0,
|
||||||
"@end lisp")
|
"@end lisp")
|
||||||
#define FUNC_NAME s_scm_array_index_map_x
|
#define FUNC_NAME s_scm_array_index_map_x
|
||||||
{
|
{
|
||||||
|
scm_t_array_handle h;
|
||||||
SCM_VALIDATE_PROC (2, proc);
|
SCM_VALIDATE_PROC (2, proc);
|
||||||
|
|
||||||
if (!scm_is_array (ra))
|
if (!scm_is_array (ra))
|
||||||
|
@ -722,15 +723,12 @@ SCM_DEFINE (scm_array_index_map_x, "array-index-map!", 2, 0, 0,
|
||||||
/* This also covers the not-SCM_I_ARRAYP case */
|
/* This also covers the not-SCM_I_ARRAYP case */
|
||||||
else if (1 == scm_c_array_rank(ra))
|
else if (1 == scm_c_array_rank(ra))
|
||||||
{
|
{
|
||||||
scm_t_array_handle h;
|
|
||||||
ssize_t i, inc;
|
ssize_t i, inc;
|
||||||
size_t p;
|
size_t p;
|
||||||
SCM v;
|
|
||||||
scm_array_get_handle (ra, &h);
|
scm_array_get_handle (ra, &h);
|
||||||
v = h.array;
|
|
||||||
inc = h.dims[0].inc;
|
inc = h.dims[0].inc;
|
||||||
for (i = h.dims[0].lbnd, p = h.base; i <= h.dims[0].ubnd; ++i, p += inc)
|
for (i = h.dims[0].lbnd, p = h.base; i <= h.dims[0].ubnd; ++i, p += inc)
|
||||||
h.impl->vset (v, p, scm_call_1 (proc, scm_from_ssize_t (i)));
|
h.impl->vset (h.array, p, scm_call_1 (proc, scm_from_ssize_t (i)));
|
||||||
scm_array_handle_release (&h);
|
scm_array_handle_release (&h);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -751,6 +749,7 @@ SCM_DEFINE (scm_array_index_map_x, "array-index-map!", 2, 0, 0,
|
||||||
return SCM_UNSPECIFIED;
|
return SCM_UNSPECIFIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scm_array_get_handle (ra, &h);
|
||||||
k = kmax;
|
k = kmax;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -769,7 +768,7 @@ SCM_DEFINE (scm_array_index_map_x, "array-index-map!", 2, 0, 0,
|
||||||
for (; vi[kmax] <= SCM_I_ARRAY_DIMS (ra)[kmax].ubnd;
|
for (; vi[kmax] <= SCM_I_ARRAY_DIMS (ra)[kmax].ubnd;
|
||||||
*q = scm_from_ssize_t (++vi[kmax]))
|
*q = scm_from_ssize_t (++vi[kmax]))
|
||||||
{
|
{
|
||||||
ASET (SCM_I_ARRAY_V (ra), i, scm_apply_0 (proc, args));
|
h.impl->vset (h.array, i, scm_apply_0 (proc, args));
|
||||||
i += SCM_I_ARRAY_DIMS (ra)[kmax].inc;
|
i += SCM_I_ARRAY_DIMS (ra)[kmax].inc;
|
||||||
}
|
}
|
||||||
k--;
|
k--;
|
||||||
|
@ -786,6 +785,7 @@ SCM_DEFINE (scm_array_index_map_x, "array-index-map!", 2, 0, 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (k >= 0);
|
while (k >= 0);
|
||||||
|
scm_array_handle_release (&h);
|
||||||
}
|
}
|
||||||
return SCM_UNSPECIFIED;
|
return SCM_UNSPECIFIED;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue