From 33671bbf4f85c0468ec5899dfd632eb56bf7408c Mon Sep 17 00:00:00 2001 From: Tim Vincent Date: Thu, 24 Feb 2022 14:28:28 -0500 Subject: [PATCH] Make initial shape accum value type explicit --- cnpy.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cnpy.h b/cnpy.h index 0d3bb4c..fe8424e 100644 --- a/cnpy.h +++ b/cnpy.h @@ -121,7 +121,7 @@ namespace cnpy { } std::vector header = create_npy_header(true_data_shape); - size_t nels = std::accumulate(shape.begin(),shape.end(),1,std::multiplies()); + size_t nels = std::accumulate(shape.begin(),shape.end(),(size_t)1,std::multiplies()); fseek(fp,0,SEEK_SET); fwrite(&header[0],sizeof(char),header.size(),fp); @@ -164,7 +164,7 @@ namespace cnpy { std::vector npy_header = create_npy_header(shape); - size_t nels = std::accumulate(shape.begin(),shape.end(),1,std::multiplies()); + size_t nels = std::accumulate(shape.begin(),shape.end(),(size_t)1,std::multiplies()); size_t nbytes = nels*sizeof(T) + npy_header.size(); //get the CRC of the data to be added