diff options
Diffstat (limited to 'libguile/unif.c')
-rw-r--r-- | libguile/unif.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libguile/unif.c b/libguile/unif.c index 1cdc47895..14438b5f6 100644 --- a/libguile/unif.c +++ b/libguile/unif.c @@ -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 |