diff options
author | kmu <kmu@hdfgroup.org> | 2019-11-25 18:48:51 (GMT) |
---|---|---|
committer | kmu <kmu@hdfgroup.org> | 2019-11-25 18:48:51 (GMT) |
commit | d242a900f420b040e364f6c0976c01593e955db3 (patch) | |
tree | 7b6849d8aff9ab9c9fe4b8f6ac40113e69454de3 /tools/src/h5import/h5import.c | |
parent | 3613ec7296a782c86ea5f0706a5a0cb51602abc9 (diff) | |
download | hdf5-d242a900f420b040e364f6c0976c01593e955db3.zip hdf5-d242a900f420b040e364f6c0976c01593e955db3.tar.gz hdf5-d242a900f420b040e364f6c0976c01593e955db3.tar.bz2 |
fix issues from previous PR comments
Diffstat (limited to 'tools/src/h5import/h5import.c')
-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) |