diff options
author | kmu <kmu@hdfgroup.org> | 2019-11-25 18:48:51 (GMT) |
---|---|---|
committer | David Young <dyoung@hdfgroup.org> | 2020-05-20 14:20:23 (GMT) |
commit | bb53a566e8a45490b3179290774c3f1450d7d8dd (patch) | |
tree | f63980b1e4a4aed7a0a3cf4c3d7a3f83496c10e1 /tools/src | |
parent | 540e50df2898be8cacc151f9e2930d250337a62f (diff) | |
download | hdf5-bb53a566e8a45490b3179290774c3f1450d7d8dd.zip hdf5-bb53a566e8a45490b3179290774c3f1450d7d8dd.tar.gz hdf5-bb53a566e8a45490b3179290774c3f1450d7d8dd.tar.bz2 |
fix issues from previous PR comments
Diffstat (limited to 'tools/src')
-rw-r--r-- | tools/src/h5import/h5import.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index 40b812f..2cd826b 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -4707,14 +4707,20 @@ static int process(struct Options *opt) return (0); } -uint16_t swap_uint16( uint16_t val) +uint16_t swap_uint16(uint16_t val) { - return (uint16_t)((val << 8) | (val >> 8)); + uint16_t ret; + + ASSIGN_TO_SMALLER_SIZE(ret, uint16_t, (val << 8) | (val >> 8), int); + return ret; } int16_t swap_int16(int16_t val) { - return (uint16_t)((val << 8) | ((val >> 8) & 0xFF)); + uint16_t ret; + + ASSIGN_TO_SMALLER_SIZE(ret, int16_t, (val << 8) | ((val >> 8) & 0xFF), int); + return ret; } uint32_t swap_uint32(uint32_t val) |