mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-15 08:10:17 +02:00
* deprecated.scm (make-uniform-array): Don't pass the prototype as
the fill value, dimensions->uniform-array will do the right thing now. See scm_dimensions_to_uniform_array why we need to be tricky about the fill value. * unif.c (scm_dimensions_to_uniform_array): Use the prototype for filling when the fill paramater is omitted, as documented, but turn #\nul into 0 since s8 arrays (signified by a #\nul prototype) can not store characters.
This commit is contained in:
parent
58b1ceaf5c
commit
bbcade428b
4 changed files with 27 additions and 1 deletions
|
@ -796,6 +796,18 @@ SCM_DEFINE (scm_dimensions_to_uniform_array, "dimensions->uniform-array", 2, 1,
|
|||
|
||||
if (scm_is_integer (dims))
|
||||
dims = scm_list_1 (dims);
|
||||
|
||||
if (SCM_UNBNDP (fill))
|
||||
{
|
||||
/* Using #\nul as the prototype yields a s8 array, but numeric
|
||||
arrays can't store characters, so we have to special case this.
|
||||
*/
|
||||
if (scm_is_eq (prot, SCM_MAKE_CHAR (0)))
|
||||
fill = scm_from_int (0);
|
||||
else
|
||||
fill = prot;
|
||||
}
|
||||
|
||||
return scm_make_typed_array (prototype_to_type (prot), fill, dims);
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue