1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-28 16:00:22 +02:00

(scm_take_u8vector, etc): use uvec_sizes instead of

sizeof(CTYPE) as explained in the comment.
This commit is contained in:
Marius Vollmer 2004-10-29 14:06:02 +00:00
parent bb9f50ae10
commit d2759570ac

View file

@ -18,7 +18,9 @@
- CTYPE
The C type of the elements, for example scm_t_uint8.
The C type of the elements, for example scm_t_uint8. The code
below will never do sizeof (CTYPE), thus you can use just 'float'
for the c32 type, for example.
*/
/* The first level does not expand macros in the arguments. */
@ -56,7 +58,7 @@ SCM_DEFINE (F(scm_make_,TAG,vector), "make-"S(TAG)"vector", 1, 1, 0,
SCM
F(scm_take_,TAG,vector) (const CTYPE *data, size_t n)
{
scm_gc_register_collectable_memory ((void *)data, n*sizeof(CTYPE),
scm_gc_register_collectable_memory ((void *)data, n*uvec_sizes[TYPE],
uvec_names[TYPE]);
return take_uvec (TYPE, data, n);
}