From ca0fe02199c9b9460b5a3b905145c3968f8fac5d Mon Sep 17 00:00:00 2001 From: Joel Walker Date: Sat, 21 Dec 2019 12:48:45 -0600 Subject: [PATCH] Fix shape multiplication to use std::size_t --- cnpy.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cnpy.h b/cnpy.h index 0d3bb4c..8171c8e 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(),static_cast(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(),static_cast(1),std::multiplies()); size_t nbytes = nels*sizeof(T) + npy_header.size(); //get the CRC of the data to be added