diff options
Diffstat (limited to 'tools/lib/h5tools_str.c')
-rw-r--r-- | tools/lib/h5tools_str.c | 58 |
1 files changed, 56 insertions, 2 deletions
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index c1c6d72..7630e9a 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -795,44 +795,98 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai } else if (H5Tequal(type, H5T_NATIVE_INT)) { HDmemcpy(&tempint, vp, sizeof(int)); +#ifdef H5_HAVE_H5DUMP_PACKED_BITS + if(packed_bits_num) { + tempint = (tempint >> packed_data_offset) & packed_data_mask; + } +#endif h5tools_str_append(str, OPT(info->fmt_int, "%d"), tempint); } else if (H5Tequal(type, H5T_NATIVE_UINT)) { HDmemcpy(&tempuint, vp, sizeof(unsigned int)); +#ifdef H5_HAVE_H5DUMP_PACKED_BITS + if(packed_bits_num) { + tempuint = (tempuint >> packed_data_offset) & packed_data_mask; + } +#endif h5tools_str_append(str, OPT(info->fmt_uint, "%u"), tempuint); } else if (H5Tequal(type, H5T_NATIVE_SCHAR)) { - h5tools_str_append(str, OPT(info->fmt_schar, "%hhd"), *cp_vp); + char tempchar; + HDmemcpy(&tempchar, cp_vp, sizeof(char)); +#ifdef H5_HAVE_H5DUMP_PACKED_BITS + if(packed_bits_num) { + tempchar = (tempchar >> packed_data_offset) & packed_data_mask; + } +#endif + h5tools_str_append(str, OPT(info->fmt_schar, "%hhd"), tempchar); } else if (H5Tequal(type, H5T_NATIVE_UCHAR)) { - h5tools_str_append(str, OPT(info->fmt_uchar, "%u"), *ucp_vp); + unsigned char tempuchar; + HDmemcpy(&tempuchar, ucp_vp, sizeof(unsigned char)); +#ifdef H5_HAVE_H5DUMP_PACKED_BITS + if(packed_bits_num) { + tempuchar = (tempuchar >> packed_data_offset) & packed_data_mask; + } +#endif + h5tools_str_append(str, OPT(info->fmt_uchar, "%u"), tempuchar); } else if (H5Tequal(type, H5T_NATIVE_SHORT)) { short tempshort; HDmemcpy(&tempshort, vp, sizeof(short)); +#ifdef H5_HAVE_H5DUMP_PACKED_BITS + if(packed_bits_num) { + tempshort = (tempshort >> packed_data_offset) & packed_data_mask; + } +#endif h5tools_str_append(str, OPT(info->fmt_short, "%d"), tempshort); } else if (H5Tequal(type, H5T_NATIVE_USHORT)) { unsigned short tempushort; HDmemcpy(&tempushort, vp, sizeof(unsigned short)); +#ifdef H5_HAVE_H5DUMP_PACKED_BITS + if(packed_bits_num) { + tempushort = (tempushort >> packed_data_offset) & packed_data_mask; + } +#endif h5tools_str_append(str, OPT(info->fmt_ushort, "%u"), tempushort); } else if (H5Tequal(type, H5T_NATIVE_LONG)) { HDmemcpy(&templong, vp, sizeof(long)); +#ifdef H5_HAVE_H5DUMP_PACKED_BITS + if(packed_bits_num) { + templong = (templong >> packed_data_offset) & packed_data_mask; + } +#endif h5tools_str_append(str, OPT(info->fmt_long, "%ld"), templong); } else if (H5Tequal(type, H5T_NATIVE_ULONG)) { HDmemcpy(&tempulong, vp, sizeof(unsigned long)); +#ifdef H5_HAVE_H5DUMP_PACKED_BITS + if(packed_bits_num) { + tempulong = (tempulong >> packed_data_offset) & packed_data_mask; + } +#endif h5tools_str_append(str, OPT(info->fmt_ulong, "%lu"), tempulong); } else if (H5Tequal(type, H5T_NATIVE_LLONG)) { HDmemcpy(&templlong, vp, sizeof(long long)); +#ifdef H5_HAVE_H5DUMP_PACKED_BITS + if(packed_bits_num) { + templlong = (templlong >> packed_data_offset) & packed_data_mask; + } +#endif h5tools_str_append(str, OPT(info->fmt_llong, fmt_llong), templlong); } else if (H5Tequal(type, H5T_NATIVE_ULLONG)) { HDmemcpy(&tempullong, vp, sizeof(unsigned long long)); +#ifdef H5_HAVE_H5DUMP_PACKED_BITS + if(packed_bits_num) { + tempullong = (tempullong >> packed_data_offset) & packed_data_mask; + } +#endif h5tools_str_append(str, OPT(info->fmt_ullong, fmt_ullong), tempullong); } else if (H5Tequal(type, H5T_NATIVE_HSSIZE)) { |