diff options
author | Robb Matzke <matzke@llnl.gov> | 1998-04-08 21:43:02 (GMT) |
---|---|---|
committer | Robb Matzke <matzke@llnl.gov> | 1998-04-08 21:43:02 (GMT) |
commit | c01750fa740943c0083711b353278143c79d50a3 (patch) | |
tree | fd475b7c7a3639c05b30625b43547850d687b948 /src/H5Vprivate.h | |
parent | 68fa66bf8130d6a6e607e233da8cc61a154bf172 (diff) | |
download | hdf5-c01750fa740943c0083711b353278143c79d50a3.zip hdf5-c01750fa740943c0083711b353278143c79d50a3.tar.gz hdf5-c01750fa740943c0083711b353278143c79d50a3.tar.bz2 |
[svn-r338] Changes since 19980407
----------------------
./src/H5B.c
./src/H5D.c
./src/H5Dprivate.h
./src/H5Dpublic.h
./src/H5F.c
./src/H5Farray.c
./src/H5Fcore.c
./src/H5Ffamily.c
./src/H5Fistore.c
./src/H5Flow.c
./src/H5Fprivate.h
./src/H5Fpublic.h
./src/H5Fsec2.c
./src/H5Fsplit.c
./src/H5Fstdio.c
./src/H5G.c
./src/H5Gent.c
./src/H5Gnode.c
./src/H5HG.c
./src/H5HL.c
./src/H5MF.c
./src/H5MFprivate.h
./src/H5O.c
./src/H5Ocont.c
./src/H5Odtype.c
./src/H5Oefl.c
./src/H5Olayout.c
./src/H5Oname.c
./src/H5Oprivate.h
./src/H5Osdspace.c
./src/H5Oshared.c
./src/H5Ostab.c
./src/H5P.c
./src/H5Ppublic.h
./src/H5S.c
./src/H5Sprivate.h
./src/H5Spublic.h
./src/H5Ssimp.c
./src/H5Tconv.c
./src/H5Tpkg.h
./src/H5V.c
./src/H5Vprivate.h
./src/H5private.h
./src/H5public.h
./src/h5ls.c
./test/cmpd_dset.c
./test/dsets.c
./test/extend.c
./test/external.c
./test/hyperslab.c
./test/iopipe.c
./test/istore.c
./test/shtype.c
./test/tfile.c
./test/th5s.c
Anything having to do with the size of a dataset now uses the
types `hsize_t' and `hssize_t' which must be the same size and
at least as large as `size_t'. This isn't fully tested yet,
so hsize_t and hssize_t are defined as size_t and ssize_t in
H5public.h. Setting them to larger values will trip up gcc
versions less than 2.8.1 on x86 platforms.
Documented unused function formals with `__unused__' before
the formal name. This also has the effect of supressing
warning messages for gcc since it's defined to be
`__attribute__((unused))' in the H5private.h file.
./src/debug.c
./src/h5ls.c
If the file name contains a `%' then the file is opened as a
file family with H5P_DEFAULT for the file member access
property list.
./src/h5ls.c
The group name is optional, defaulting to `/'.
./src/hdf5.h
Added some missing public header files.
Diffstat (limited to 'src/H5Vprivate.h')
-rw-r--r-- | src/H5Vprivate.h | 161 |
1 files changed, 113 insertions, 48 deletions
diff --git a/src/H5Vprivate.h b/src/H5Vprivate.h index 76c638f..64f085a 100644 --- a/src/H5Vprivate.h +++ b/src/H5Vprivate.h @@ -11,49 +11,57 @@ #include <H5private.h> /* Vector comparison functions like Fortran66 comparison operators */ -#define H5V_vector_eq(N,V1,V2) (H5V_vector_cmp (N, V1, V2)==0) -#define H5V_vector_lt(N,V1,V2) (H5V_vector_cmp (N, V1, V2)<0) -#define H5V_vector_gt(N,V1,V2) (H5V_vector_cmp (N, V1, V2)>0) -#define H5V_vector_le(N,V1,V2) (H5V_vector_cmp (N, V1, V2)<=0) -#define H5V_vector_ge(N,V1,V2) (H5V_vector_cmp (N, V1, V2)>=0) +#define H5V_vector_eq_s(N,V1,V2) (H5V_vector_cmp_s (N, V1, V2)==0) +#define H5V_vector_lt_s(N,V1,V2) (H5V_vector_cmp_s (N, V1, V2)<0) +#define H5V_vector_gt_s(N,V1,V2) (H5V_vector_cmp_s (N, V1, V2)>0) +#define H5V_vector_le_s(N,V1,V2) (H5V_vector_cmp_s (N, V1, V2)<=0) +#define H5V_vector_ge_s(N,V1,V2) (H5V_vector_cmp_s (N, V1, V2)>=0) +#define H5V_vector_eq_u(N,V1,V2) (H5V_vector_cmp_u (N, V1, V2)==0) +#define H5V_vector_lt_u(N,V1,V2) (H5V_vector_cmp_u (N, V1, V2)<0) +#define H5V_vector_gt_u(N,V1,V2) (H5V_vector_cmp_u (N, V1, V2)>0) +#define H5V_vector_le_u(N,V1,V2) (H5V_vector_cmp_u (N, V1, V2)<=0) +#define H5V_vector_ge_u(N,V1,V2) (H5V_vector_cmp_u (N, V1, V2)>=0) /* Other functions */ #define H5V_vector_cpy(N,DST,SRC) { \ - if (SRC) HDmemcpy (DST, SRC, (N)*sizeof(size_t)); \ - else HDmemset (DST, 0, (N)*sizeof(size_t)); \ + assert (sizeof(*(DST))==sizeof(*(SRC))); \ + if (SRC) HDmemcpy (DST, SRC, (N)*sizeof(*(DST))); \ + else HDmemset (DST, 0, (N)*sizeof(*(DST))); \ } -#define H5V_vector_zero(N,DST) HDmemset(DST,0,(N)*sizeof(size_t)) +#define H5V_vector_zero(N,DST) HDmemset(DST,0,(N)*sizeof(*(DST))) /* A null pointer is equivalent to a zero vector */ #define H5V_ZERO NULL -size_t H5V_hyper_stride(intn n, const size_t *size, const size_t *total_size, - const size_t *offset, ssize_t *stride); -hbool_t H5V_hyper_disjointp(intn n, const size_t *offset1, - const size_t *size1, const size_t *offset2, - const size_t *size2); -hbool_t H5V_hyper_eq(intn n, const size_t *offset1, const size_t *size1, - const size_t *offset2, const size_t *size2); -herr_t H5V_hyper_fill(intn n, const size_t *total_size, const size_t *offset, - const size_t *size, void *buf, uintn val); -herr_t H5V_hyper_copy(intn n, const size_t *size, - const size_t *dst_total_size, const size_t *dst_offset, - void *_dst, const size_t *src_total_size, - const size_t *src_offset, const void *_src); -herr_t H5V_stride_fill(intn n, size_t elmt_size, const size_t *size, - const ssize_t *stride, void *_dst, uintn fill_value); -herr_t H5V_stride_copy(intn n, size_t elmt_size, const size_t *_size, - const ssize_t *dst_stride, void *_dst, - const ssize_t *src_stride, const void *_src); -herr_t H5V_stride_copy2(size_t nelmts, size_t elmt_size, intn dst_n, - const size_t *dst_size, const ssize_t *dst_stride, - void *_dst, intn src_n, const size_t *src_size, - const ssize_t *src_stride, const void *_src); -herr_t H5V_stride_optimize1(intn *np, size_t *elmt_size, size_t *size, - ssize_t *stride1); -herr_t H5V_stride_optimize2(intn *np, size_t *elmt_size, size_t *size, - ssize_t *stride1, ssize_t *stride2); +hsize_t H5V_hyper_stride(intn n, const hsize_t *size, + const hsize_t *total_size, const hssize_t *offset, + hssize_t *stride); +hbool_t H5V_hyper_disjointp(intn n, const hssize_t *offset1, + const hsize_t *size1, const hssize_t *offset2, + const hsize_t *size2); +hbool_t H5V_hyper_eq(intn n, const hssize_t *offset1, const hsize_t *size1, + const hssize_t *offset2, const hsize_t *size2); +herr_t H5V_hyper_fill(intn n, const hsize_t *_size, const hsize_t *total_size, + const hssize_t *offset, void *_dst, uintn fill_value); +herr_t H5V_hyper_copy(intn n, const hsize_t *size, + const hsize_t *dst_total_size, + const hssize_t *dst_offset, void *_dst, + const hsize_t *src_total_size, + const hssize_t *src_offset, const void *_src); +herr_t H5V_stride_fill(intn n, hsize_t elmt_size, const hsize_t *size, + const hssize_t *stride, void *_dst, uintn fill_value); +herr_t H5V_stride_copy(intn n, hsize_t elmt_size, const hsize_t *_size, + const hssize_t *dst_stride, void *_dst, + const hssize_t *src_stride, const void *_src); +herr_t H5V_stride_copy2(hsize_t nelmts, hsize_t elmt_size, intn dst_n, + const hsize_t *dst_size, const hssize_t *dst_stride, + void *_dst, intn src_n, const hsize_t *src_size, + const hssize_t *src_stride, const void *_src); +herr_t H5V_stride_optimize1(intn *np, hsize_t *elmt_size, hsize_t *size, + hssize_t *stride1); +herr_t H5V_stride_optimize2(intn *np, hsize_t *elmt_size, hsize_t *size, + hssize_t *stride1, hssize_t *stride2); /*------------------------------------------------------------------------- @@ -75,9 +83,8 @@ herr_t H5V_stride_optimize2(intn *np, size_t *elmt_size, size_t *size, * *------------------------------------------------------------------------- */ -static inline size_t -__attribute__((unused)) -H5V_vector_reduce_product(intn n, const size_t *v) +static inline hsize_t __unused__ +H5V_vector_reduce_product(intn n, const hsize_t *v) { size_t ans = 1; @@ -87,7 +94,7 @@ H5V_vector_reduce_product(intn n, const size_t *v) } /*------------------------------------------------------------------------- - * Function: H5V_vector_zerop + * Function: H5V_vector_zerop_u * * Purpose: Determines if all elements of a vector are zero. * @@ -103,9 +110,8 @@ H5V_vector_reduce_product(intn n, const size_t *v) * *------------------------------------------------------------------------- */ -static inline hbool_t -__attribute__((unused)) -H5V_vector_zerop(intn n, const size_t *v) +static inline hbool_t __unused__ +H5V_vector_zerop_u(intn n, const hsize_t *v) { if (!v) return TRUE; while (n--) { @@ -115,7 +121,34 @@ H5V_vector_zerop(intn n, const size_t *v) } /*------------------------------------------------------------------------- - * Function: H5V_vector_cmp + * Function: H5V_vector_zerop_s + * + * Purpose: Determines if all elements of a vector are zero. + * + * Return: Success: TRUE if all elements are zero, + * FALSE otherwise + * + * Failure: TRUE if N is zero + * + * Programmer: Robb Matzke + * Friday, October 10, 1997 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static inline hbool_t __unused__ +H5V_vector_zerop_s(intn n, const hssize_t *v) +{ + if (!v) return TRUE; + while (n--) { + if (*v++) return FALSE; + } + return TRUE; +} + +/*------------------------------------------------------------------------- + * Function: H5V_vector_cmp_u * * Purpose: Compares two vectors of the same size and determines if V1 is * lexicographically less than, equal, or greater than V2. @@ -133,9 +166,8 @@ H5V_vector_zerop(intn n, const size_t *v) * *------------------------------------------------------------------------- */ -static inline intn -__attribute__((unused)) -H5V_vector_cmp(intn n, const size_t *v1, const size_t *v2) +static inline intn __unused__ +H5V_vector_cmp_u (intn n, const hsize_t *v1, const hsize_t *v2) { if (v1 == v2) return 0; while (n--) { @@ -146,6 +178,40 @@ H5V_vector_cmp(intn n, const size_t *v1, const size_t *v2) } return 0; } + + +/*------------------------------------------------------------------------- + * Function: H5V_vector_cmp_s + * + * Purpose: Compares two vectors of the same size and determines if V1 is + * lexicographically less than, equal, or greater than V2. + * + * Return: Success: -1 if V1 is less than V2 + * 0 if they are equal + * 1 if V1 is greater than V2 + * + * Failure: 0 if N is zero + * + * Programmer: Robb Matzke + * Wednesday, April 8, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static inline intn __unused__ +H5V_vector_cmp_s (intn n, const hssize_t *v1, const hssize_t *v2) +{ + if (v1 == v2) return 0; + while (n--) { + if ((v1 ? *v1 : 0) < (v2 ? *v2 : 0)) return -1; + if ((v1 ? *v1 : 0) > (v2 ? *v2 : 0)) return 1; + if (v1) v1++; + if (v2) v2++; + } + return 0; +} + /*------------------------------------------------------------------------- * Function: H5V_vector_inc @@ -161,9 +227,8 @@ H5V_vector_cmp(intn n, const size_t *v1, const size_t *v2) * *------------------------------------------------------------------------- */ -static inline void -__attribute__((unused)) -H5V_vector_inc(intn n, size_t *v1, const size_t *v2) +static inline void __unused__ +H5V_vector_inc(intn n, hsize_t *v1, const hsize_t *v2) { while (n--) *v1++ += *v2++; } |