mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-16 16:50:21 +02:00
(scm_take_u64vector,
scm_array_handle_u64_elements, scm_array_handle_u64_writable_elements, scm_u64vector_elements, scm_u64vector_writable_elements): Do not define when scm_t_uint64 is not available. (scm_take_s64vector, scm_array_handle_s64_elements, scm_array_handle_s64_writable_elements, scm_s64vector_elements, scm_s64vector_writable_elements): Likewise for scm_t_int64. (uvec_sizes, uvec_print, uvec_equalp): Use SCM bignums when scm_t_int64/scm_t_uint64 are not available. (uvec_mark): New, to mark the bignums. (alloc_uvec): Initialize bignums. (uvec_fast_ref): Return bignums directly. (scm_uint64_min, scm_uint64_max, scm_int64_min, scm_int64_max, assert_exact_integer): New. (uvec_fast_set): Use them to validate the bignums. (scm_init_srfi_4): Set mark function of smob when needed. Initialize scm_uint64_min, scm_uint64_max, scm_int64_min, scm_int64_max.
This commit is contained in:
parent
55fcbb966b
commit
00c17d4526
3 changed files with 127 additions and 11 deletions
|
@ -21,6 +21,8 @@
|
|||
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.
|
||||
|
||||
When CTYPE is not defined, the functions using it are excluded.
|
||||
*/
|
||||
|
||||
/* The first level does not expand macros in the arguments. */
|
||||
|
@ -55,14 +57,6 @@ SCM_DEFINE (F(scm_make_,TAG,vector), "make-"S(TAG)"vector", 1, 1, 0,
|
|||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
SCM
|
||||
F(scm_take_,TAG,vector) (const CTYPE *data, size_t n)
|
||||
{
|
||||
scm_gc_register_collectable_memory ((void *)data, n*uvec_sizes[TYPE],
|
||||
uvec_names[TYPE]);
|
||||
return take_uvec (TYPE, data, n);
|
||||
}
|
||||
|
||||
SCM_DEFINE (F(scm_,TAG,vector), S(TAG)"vector", 0, 0, 1,
|
||||
(SCM l),
|
||||
"Return a newly allocated uniform numeric vector containing\n"
|
||||
|
@ -138,6 +132,16 @@ SCM_DEFINE (F(scm_any_to_,TAG,vector), "any->"S(TAG)"vector", 1, 0, 0,
|
|||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
#ifdef CTYPE
|
||||
|
||||
SCM
|
||||
F(scm_take_,TAG,vector) (const CTYPE *data, size_t n)
|
||||
{
|
||||
scm_gc_register_collectable_memory ((void *)data, n*uvec_sizes[TYPE],
|
||||
uvec_names[TYPE]);
|
||||
return take_uvec (TYPE, data, n);
|
||||
}
|
||||
|
||||
const CTYPE *
|
||||
F(scm_array_handle_,TAG,_elements) (scm_t_array_handle *h)
|
||||
{
|
||||
|
@ -180,6 +184,8 @@ F(scm_,TAG,vector_writable_elements) (SCM uvec,
|
|||
return F(scm_array_handle_,TAG,_writable_elements) (h);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static SCM
|
||||
F(,TAG,ref) (scm_t_array_handle *handle, ssize_t pos)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue