summaryrefslogtreecommitdiff
path: root/otherlibs/bigarray
diff options
context:
space:
mode:
authorGabriel Scherer <gabriel.scherer@gmail.com>2016-09-01 20:39:34 +0200
committerGabriel Scherer <gabriel.scherer@gmail.com>2016-09-01 20:39:34 +0200
commit014d94159dbbf086bd63e49833e78922680e0f9a (patch)
treecdb848ef0ada85590c4e1511ea72a5421f089155 /otherlibs/bigarray
parent500c3aca0d4374545f5fce7419602e68069fc3e4 (diff)
downloadocaml-014d94159dbbf086bd63e49833e78922680e0f9a.tar.gz
bigarray_stubs.c: fix code raising a legitimate clang warning
Diffstat (limited to 'otherlibs/bigarray')
-rw-r--r--otherlibs/bigarray/bigarray_stubs.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/otherlibs/bigarray/bigarray_stubs.c b/otherlibs/bigarray/bigarray_stubs.c
index 03ed30f612..7021af1f3a 100644
--- a/otherlibs/bigarray/bigarray_stubs.c
+++ b/otherlibs/bigarray/bigarray_stubs.c
@@ -202,7 +202,8 @@ CAMLprim value caml_ba_create(value vkind, value vlayout, value vdim)
int i, flags;
num_dims = Wosize_val(vdim);
- if (num_dims < 0 || num_dims > CAML_BA_MAX_NUM_DIMS)
+ /* here num_dims is unsigned (mlsize_t) so no need to check (num_dims >= 0) */
+ if (num_dims > CAML_BA_MAX_NUM_DIMS)
caml_invalid_argument("Bigarray.create: bad number of dimensions");
for (i = 0; i < num_dims; i++) {
dim[i] = Long_val(Field(vdim, i));
@@ -1299,7 +1300,8 @@ CAMLprim value caml_ba_reshape(value vb, value vdim)
int i;
num_dims = Wosize_val(vdim);
- if (num_dims < 0 || num_dims > CAML_BA_MAX_NUM_DIMS)
+ /* here num_dims is unsigned (mlsize_t) so no need to check (num_dims >= 0) */
+ if (num_dims > CAML_BA_MAX_NUM_DIMS)
caml_invalid_argument("Bigarray.reshape: bad number of dimensions");
num_elts = 1;
for (i = 0; i < num_dims; i++) {