From af79526ebe390fcb6002d23f8b451619d9095ec1 Mon Sep 17 00:00:00 2001 From: Vasily Postnicov Date: Tue, 19 Sep 2023 11:18:36 +0300 Subject: [PATCH] Fix reading of boolean arrays --- src/NPZ.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/NPZ.jl b/src/NPZ.jl index adbf1bb..c00e5d7 100644 --- a/src/NPZ.jl +++ b/src/NPZ.jl @@ -15,6 +15,7 @@ const Version = UInt8[1, 0] const MaxMagicLen = maximum(length.([NPYMagic, ZIPMagic])) const TypeMaps = [ + ("?", Bool), ("b1", Bool), ("i1", Int8), ("i2", Int16), @@ -126,7 +127,10 @@ function parsedtype(s::AbstractString) dtype, s = parsestring(s) c = dtype[firstindex(s)] t = SubString(dtype, nextind(s, 1)) - if c == '<' + if isempty(t) + toh = identity + t = string(c) + elseif c == '<' toh = ltoh elseif c == '>' toh = ntoh