mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
(scm_c_uniform_vector_element_size,
scm_c_uniform_vector_size): Removed. (scm_array_handle_uniform_element_size): New.
This commit is contained in:
parent
996baf27e9
commit
fea99690f2
2 changed files with 17 additions and 21 deletions
|
@ -482,15 +482,6 @@ scm_c_uniform_vector_length (SCM v)
|
|||
scm_wrong_type_arg_msg (NULL, 0, v, "uniform vector");
|
||||
}
|
||||
|
||||
size_t
|
||||
scm_c_uniform_vector_size (SCM v)
|
||||
{
|
||||
if (scm_is_uniform_vector (v))
|
||||
return SCM_UVEC_LENGTH (v) * uvec_sizes[SCM_UVEC_TYPE (v)];
|
||||
else
|
||||
scm_wrong_type_arg_msg (NULL, 0, v, "uniform vector");
|
||||
}
|
||||
|
||||
SCM_DEFINE (scm_uniform_vector_p, "uniform-vector?", 1, 0, 0,
|
||||
(SCM obj),
|
||||
"Return @code{#t} if @var{obj} is a uniform vector.")
|
||||
|
@ -585,12 +576,14 @@ SCM_DEFINE (scm_uniform_vector_to_list, "uniform-vector->list", 1, 0, 0,
|
|||
#undef FUNC_NAME
|
||||
|
||||
size_t
|
||||
scm_uniform_vector_element_size (SCM uvec)
|
||||
scm_array_handle_uniform_element_size (scm_t_array_handle *h)
|
||||
{
|
||||
if (scm_is_uniform_vector (uvec))
|
||||
return uvec_sizes[SCM_UVEC_TYPE (uvec)];
|
||||
else
|
||||
scm_wrong_type_arg_msg (NULL, 0, uvec, "uniform vector");
|
||||
SCM vec = h->array;
|
||||
if (SCM_ARRAYP (vec))
|
||||
vec = SCM_ARRAY_V (vec);
|
||||
if (scm_is_uniform_vector (vec))
|
||||
return uvec_sizes[SCM_UVEC_TYPE(vec)];
|
||||
scm_wrong_type_arg_msg (NULL, 0, h->array, "uniform array");
|
||||
}
|
||||
|
||||
/* return the size of an element in a uniform array or 0 if type not
|
||||
|
@ -599,7 +592,7 @@ size_t
|
|||
scm_uniform_element_size (SCM obj)
|
||||
{
|
||||
if (scm_is_uniform_vector (obj))
|
||||
return scm_uniform_vector_element_size (obj);
|
||||
return uvec_sizes[SCM_UVEC_TYPE(obj)];
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
@ -638,7 +631,7 @@ scm_uniform_vector_writable_elements (SCM uvec,
|
|||
scm_t_array_handle *h,
|
||||
size_t *lenp, ssize_t *incp)
|
||||
{
|
||||
scm_vector_get_handle (uvec, h);
|
||||
scm_generalized_vector_get_handle (uvec, h);
|
||||
if (lenp)
|
||||
{
|
||||
scm_t_array_dim *dim = scm_array_handle_dims (h);
|
||||
|
@ -696,7 +689,7 @@ SCM_DEFINE (scm_uniform_vector_read_x, "uniform-vector-read!", 1, 3, 0,
|
|||
scm_wrong_type_arg_msg (NULL, 0, uvec, "uniform vector");
|
||||
|
||||
base = scm_uniform_vector_writable_elements (uvec, &handle, &vlen, &inc);
|
||||
sz = scm_uniform_vector_element_size (uvec);
|
||||
sz = scm_array_handle_uniform_element_size (&handle);
|
||||
|
||||
if (inc != 1)
|
||||
{
|
||||
|
@ -765,6 +758,8 @@ SCM_DEFINE (scm_uniform_vector_read_x, "uniform-vector-read!", 1, 3, 0,
|
|||
ans = n / sz;
|
||||
}
|
||||
|
||||
scm_array_handle_release (&handle);
|
||||
|
||||
return scm_from_size_t (ans);
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
@ -806,7 +801,7 @@ SCM_DEFINE (scm_uniform_vector_write, "uniform-vector-write", 1, 3, 0,
|
|||
port_or_fd, SCM_ARG2, FUNC_NAME);
|
||||
|
||||
base = scm_uniform_vector_elements (uvec, &handle, &vlen, &inc);
|
||||
sz = scm_uniform_vector_element_size (uvec);
|
||||
sz = scm_array_handle_uniform_element_size (&handle);
|
||||
|
||||
if (inc != 1)
|
||||
{
|
||||
|
@ -843,6 +838,8 @@ SCM_DEFINE (scm_uniform_vector_write, "uniform-vector-write", 1, 3, 0,
|
|||
ans = n / sz;
|
||||
}
|
||||
|
||||
scm_array_handle_release (&handle);
|
||||
|
||||
return scm_from_size_t (ans);
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
|
|
@ -38,10 +38,9 @@ SCM_API SCM scm_uniform_vector_write (SCM v, SCM port_or_fd,
|
|||
|
||||
SCM_API int scm_is_uniform_vector (SCM obj);
|
||||
SCM_API size_t scm_c_uniform_vector_length (SCM v);
|
||||
SCM_API size_t scm_c_uniform_vector_size (SCM v);
|
||||
SCM_API SCM scm_c_uniform_vector_ref (SCM v, size_t idx);
|
||||
SCM_API void scm_c_uniform_vector_set_x (SCM v, size_t idx, SCM val);
|
||||
SCM_API size_t scm_uniform_vector_element_size (SCM v);
|
||||
SCM_API size_t scm_array_handle_uniform_element_size (scm_t_array_handle *h);
|
||||
SCM_API const void *scm_array_handle_uniform_elements (scm_t_array_handle *h);
|
||||
SCM_API void *scm_array_handle_uniform_writable_elements (scm_t_array_handle *h);
|
||||
SCM_API const void *scm_uniform_vector_elements (SCM uvec,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue