From fc308501009270b0273024f61cbcd3fe320e2a73 Mon Sep 17 00:00:00 2001 From: LTLA Date: Mon, 2 Oct 2023 13:15:31 -0700 Subject: [PATCH] Slightly more elegant. --- include/uzuki2/parse_hdf5.hpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/include/uzuki2/parse_hdf5.hpp b/include/uzuki2/parse_hdf5.hpp index 67503e2..26f88ef 100644 --- a/include/uzuki2/parse_hdf5.hpp +++ b/include/uzuki2/parse_hdf5.hpp @@ -202,21 +202,20 @@ inline double legacy_missing_double() { double missing_value = 0; auto missing_ptr = reinterpret_cast(&missing_value); - int start = 0; int step = 1; if (tmp_ptr[0] == 1) { // little-endian. - start = 7; + missing_ptr += sizeof(double) - 1; step = -1; } - missing_ptr[start] = 0x7f; - missing_ptr[start += step] = 0xf0; - missing_ptr[start += step] = 0x00; - missing_ptr[start += step] = 0x00; - missing_ptr[start += step] = 0x00; - missing_ptr[start += step] = 0x00; - missing_ptr[start += step] = 0x07; - missing_ptr[start += step] = 0xa2; + *missing_ptr = 0x7f; + *(missing_ptr += step) = 0xf0; + *(missing_ptr += step) = 0x00; + *(missing_ptr += step) = 0x00; + *(missing_ptr += step) = 0x00; + *(missing_ptr += step) = 0x00; + *(missing_ptr += step) = 0x07; + *(missing_ptr += step) = 0xa2; return missing_value; }