return uvec_writable_elements (type, uvec, handle, lenp, incp);
}
+static int
+uvec_type (scm_t_array_handle *h)
+{
+ SCM v = h->array;
+ if (SCM_ARRAYP (v))
+ v = SCM_ARRAY_V (v);
+ return SCM_UVEC_TYPE (v);
+}
+
static SCM
uvec_to_list (int type, SCM uvec)
{
SCM res = SCM_EOL;
elts = uvec_elements (type, uvec, &handle, &len, &inc);
+ if (type < 0)
+ type = uvec_type (&handle);
for (i = len*inc; i > 0;)
{
i -= inc;
SCM res;
elts = uvec_elements (type, uvec, &handle, &len, &inc);
+ if (type < 0)
+ type = uvec_type (&handle);
i = scm_to_unsigned_integer (idx, 0, len-1);
res = uvec_fast_ref (type, elts, i*inc);
scm_array_handle_release (&handle);
void *elts;
elts = uvec_writable_elements (type, uvec, &handle, &len, &inc);
+ if (type < 0)
+ type = uvec_type (&handle);
i = scm_to_unsigned_integer (idx, 0, len-1);
uvec_fast_set_x (type, elts, i*inc, val);
scm_array_handle_release (&handle);
size_t len;
ssize_t inc;
SCM res;
+ int type;
elts = uvec_elements (-1, v, &handle, &len, &inc);
+ type = uvec_type (&handle);
if (idx >= len)
scm_out_of_range (NULL, scm_from_size_t (idx));
- res = uvec_fast_ref (SCM_UVEC_TYPE (v), elts, idx*inc);
+ res = uvec_fast_ref (type, elts, idx*inc);
scm_array_handle_release (&handle);
return res;
}
void *elts;
size_t len;
ssize_t inc;
+ int type;
elts = uvec_writable_elements (-1, v, &handle, &len, &inc);
+ type = uvec_type (&handle);
if (idx >= len)
scm_out_of_range (NULL, scm_from_size_t (idx));
- uvec_fast_set_x (SCM_UVEC_TYPE (v), elts, idx*inc, val);
+ uvec_fast_set_x (type, elts, idx*inc, val);
scm_array_handle_release (&handle);
}