summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2010-05-15 05:40:00 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2010-05-15 05:40:00 (GMT)
commit174cc7b19e078a41d97ed42e396127f1f76b889f (patch)
tree292e6f8aaddfa3ae8bffbe1dd65eccd8f04d9a7f /tools/lib
parentb8f131dc78aba5ce6998401bc6de2b4a69b44412 (diff)
downloadhdf5-174cc7b19e078a41d97ed42e396127f1f76b889f.zip
hdf5-174cc7b19e078a41d97ed42e396127f1f76b889f.tar.gz
hdf5-174cc7b19e078a41d97ed42e396127f1f76b889f.tar.bz2
[svn-r18821] Packed bits codes tidy up. Removed codes that are not needed
any more. Changed algorithm of creating mask which now sits at the least significant bits. Display data by down shift first and then mask it for display. Changed the variable names to reflect the new purpose better. Tested: AlbertPax (linux)
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/h5tools.c4
-rw-r--r--tools/lib/h5tools.h4
-rw-r--r--tools/lib/h5tools_str.c16
3 files changed, 12 insertions, 12 deletions
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index cce7d47..e8657e1 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -44,8 +44,8 @@ int bin_form; /* binary form */
int region_output; /* region output */
#ifdef H5_HAVE_H5DUMP_PACKED_BITS
int packed_bits_num; /* number of packed bits to display */
-int packed_normalize; /* number of bits to shift right to display normalized */
-unsigned int packed_counter; /* counter for which packed bits to display */
+int packed_data_offset; /* offset of packed bits to display */
+unsigned int packed_data_mask; /* mask in which packed bits to display */
#endif
static h5tool_format_t h5tools_dataformat = {
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index b44948a..2c8ec96 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -527,8 +527,8 @@ extern "C" {
#ifdef H5_HAVE_H5DUMP_PACKED_BITS
H5TOOLS_DLLVAR int packed_bits_num; /* number of packed bits to display */
-H5TOOLS_DLLVAR int packed_normalize; /* number of bits to shift right to display normalized */
-H5TOOLS_DLLVAR unsigned int packed_counter; /* counter for which packed bits to display */
+H5TOOLS_DLLVAR int packed_data_offset; /* offset of packed bits to display */
+H5TOOLS_DLLVAR unsigned int packed_data_mask; /* mask in which packed bits to display */
#endif
H5TOOLS_DLLVAR FILE *rawdatastream; /* output stream for raw data */
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index b1c017a..da9218f 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -785,7 +785,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
HDmemcpy(&tempint, vp, sizeof(int));
#ifdef H5_HAVE_H5DUMP_PACKED_BITS
if(packed_bits_num)
- tempint = (tempint & packed_counter)>>packed_normalize;
+ tempint = (tempint >> packed_data_offset) & packed_data_mask;
#endif
h5tools_str_append(str, OPT(info->fmt_int, "%d"), tempint);
}
@@ -793,7 +793,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
HDmemcpy(&tempuint, vp, sizeof(unsigned int));
#ifdef H5_HAVE_H5DUMP_PACKED_BITS
if(packed_bits_num)
- tempuint = (tempuint & packed_counter)>>packed_normalize;
+ tempuint = (tempuint >> packed_data_offset) & packed_data_mask;
#endif
h5tools_str_append(str, OPT(info->fmt_uint, "%u"), tempuint);
}
@@ -802,7 +802,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
HDmemcpy(&tempchar, cp_vp, sizeof(char));
#ifdef H5_HAVE_H5DUMP_PACKED_BITS
if(packed_bits_num)
- tempchar = (tempchar & packed_counter)>>packed_normalize;
+ tempchar = (tempchar >> packed_data_offset) & packed_data_mask;
#endif
h5tools_str_append(str, OPT(info->fmt_schar, "%d"), tempchar);
}
@@ -811,7 +811,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
HDmemcpy(&tempuchar, ucp_vp, sizeof(unsigned char));
#ifdef H5_HAVE_H5DUMP_PACKED_BITS
if(packed_bits_num)
- tempuchar = (tempuchar & packed_counter)>>packed_normalize;
+ tempuchar = (tempuchar >> packed_data_offset) & packed_data_mask;
#endif
h5tools_str_append(str, OPT(info->fmt_uchar, "%u"), tempuchar);
}
@@ -821,7 +821,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
HDmemcpy(&tempshort, vp, sizeof(short));
#ifdef H5_HAVE_H5DUMP_PACKED_BITS
if(packed_bits_num)
- tempshort = (tempshort & packed_counter)>>packed_normalize;
+ tempshort = (tempshort >> packed_data_offset) & packed_data_mask;
#endif
h5tools_str_append(str, OPT(info->fmt_short, "%d"), tempshort);
}
@@ -831,7 +831,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
HDmemcpy(&tempushort, vp, sizeof(unsigned short));
#ifdef H5_HAVE_H5DUMP_PACKED_BITS
if(packed_bits_num)
- tempushort = (tempushort & packed_counter)>>packed_normalize;
+ tempushort = (tempushort >> packed_data_offset) & packed_data_mask;
#endif
h5tools_str_append(str, OPT(info->fmt_ushort, "%u"), tempushort);
}
@@ -839,7 +839,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
HDmemcpy(&templong, vp, sizeof(long));
#ifdef H5_HAVE_H5DUMP_PACKED_BITS
if(packed_bits_num)
- templong = (templong & packed_counter)>>packed_normalize;
+ templong = (templong >> packed_data_offset) & packed_data_mask;
#endif
h5tools_str_append(str, OPT(info->fmt_long, "%ld"), templong);
}
@@ -847,7 +847,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
HDmemcpy(&tempulong, vp, sizeof(unsigned long));
#ifdef H5_HAVE_H5DUMP_PACKED_BITS
if(packed_bits_num)
- tempulong = (tempulong & packed_counter)>>packed_normalize;
+ tempulong = (tempulong >> packed_data_offset) & packed_data_mask;
#endif
h5tools_str_append(str, OPT(info->fmt_ulong, "%lu"), tempulong);
}