Skip to content

Commit 217fd16

Browse files
committed
Use 32-bit Python ints to construct INT32_MISSING, INT32_FILL
1 parent 8c42573 commit 217fd16

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

sgkit/io/utils.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,19 @@
99
from ..utils import encode_array, max_str_len
1010

1111
# These values are based on BCF conventions
12-
INT32_MISSING, INT32_FILL = np.array([0x80000000, 0x80000001], dtype=np.int32)
12+
INT32_MISSING, INT32_FILL = np.array(
13+
# Equivalent to 0x80000000, 0x80000001
14+
[np.iinfo(np.int32).min, np.iinfo(np.int32).min + 1],
15+
dtype=np.int32,
16+
)
17+
1318
FLOAT32_MISSING, FLOAT32_FILL = np.array([0x7F800001, 0x7F800002], dtype=np.int32).view(
1419
np.float32
1520
)
1621
FLOAT32_MISSING_AS_INT32, FLOAT32_FILL_AS_INT32 = np.array(
1722
[0x7F800001, 0x7F800002], dtype=np.int32
1823
)
24+
1925
STR_MISSING, STR_FILL = ".", ""
2026

2127

0 commit comments

Comments
 (0)