Use correct var types for data

This commit is contained in:
Allen Byrne 2017-05-04 13:31:48 -05:00
parent 5d921b8fee
commit 412f68103e
3 changed files with 35 additions and 34 deletions

View File

@ -9717,18 +9717,19 @@ static void gent_bitnopaquefields(void)
/* Compound datatype */
typedef struct s_t
{
unsigned char a;
unsigned int b;
unsigned long c;
unsigned long long d;
uint8_t a;
uint16_t b;
uint32_t c;
uint64_t d;
} s_t;
hid_t file, grp=-1, type=-1, space=-1, dset=-1;
size_t i;
hsize_t nelmts = F80_DIM32;
unsigned char buf[F80_DIM32]; /* bitfield, opaque */
unsigned int buf2[F80_DIM32]; /* bitfield, opaque */
unsigned long buf3[F80_DIM32]; /* bitfield, opaque */
unsigned long long buf4[F80_DIM32]; /* bitfield, opaque */
uint8_t buf[F80_DIM32]; /* bitfield, opaque */
uint16_t buf2[F80_DIM32]; /* bitfield, opaque */
uint32_t buf3[F80_DIM32]; /* bitfield, opaque */
uint64_t buf4[F80_DIM32]; /* bitfield, opaque */
s_t buf5[F80_DIM32]; /* compound */
file = H5Fcreate(FILE80, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@ -9739,7 +9740,7 @@ static void gent_bitnopaquefields(void)
if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
if ((dset = H5Dcreate2(grp, "bitfield_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
for (i = 0; i < nelmts; i++) {
buf[i] = (unsigned char)0xff ^ (unsigned char)i;
buf[i] = (uint8_t)0xff ^ (uint8_t)i;
}
H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
H5Dclose(dset);
@ -9754,7 +9755,7 @@ static void gent_bitnopaquefields(void)
if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
if ((dset = H5Dcreate2(grp, "bitfield_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
for (i = 0; i < nelmts; i++) {
buf2[i] = (unsigned int)0xffff ^ (unsigned int)(i * 16);
buf2[i] = (uint16_t)0xffff ^ (uint16_t)(i * 16);
}
H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2);
H5Dclose(dset);
@ -9769,7 +9770,7 @@ static void gent_bitnopaquefields(void)
if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
if ((dset = H5Dcreate2(grp, "bitfield_3", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
for (i = 0; i < nelmts; i++) {
buf3[i] = (unsigned long)0xffffffff ^ (unsigned long)(i * 32);
buf3[i] = (uint32_t)0xffffffff ^ (uint32_t)(i * 32);
}
H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf3);
H5Dclose(dset);
@ -9784,7 +9785,7 @@ static void gent_bitnopaquefields(void)
if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
if ((dset = H5Dcreate2(grp, "bitfield_4", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
for (i = 0; i < nelmts; i++) {
buf4[i] = (unsigned long long)0xffffffffffffffff ^ (unsigned long long)(i * 64);
buf4[i] = (uint64_t)0xffffffffffffffff ^ (uint64_t)(i * 64);
}
H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf4);
H5Dclose(dset);
@ -9804,7 +9805,7 @@ static void gent_bitnopaquefields(void)
if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
if ((dset = H5Dcreate2(grp, "opaque_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
for(i = 0; i < nelmts; i++)
buf[i] = (unsigned char)0xff ^ (unsigned char)i;
buf[i] = (uint8_t)0xff ^ (uint8_t)i;
H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
H5Dclose(dset);
}
@ -9820,7 +9821,7 @@ static void gent_bitnopaquefields(void)
if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
if ((dset = H5Dcreate2(grp, "opaque_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
for(i = 0; i < nelmts; i++)
buf2[i] = (unsigned int)0xffff ^ (unsigned int)(i * 16);
buf2[i] = (uint16_t)0xffff ^ (uint16_t)(i * 16);
H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2);
H5Dclose(dset);
@ -9843,10 +9844,10 @@ static void gent_bitnopaquefields(void)
if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
if ((dset = H5Dcreate2(grp, "compound_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
for(i = 0; i < nelmts; i++) {
buf5[i].a = (unsigned char)0xff ^ (unsigned char)i;
buf5[i].b = (unsigned int)0xffff ^ (unsigned int)(i * 16);
buf5[i].c = (unsigned long)0xffffffff ^ (unsigned long)(i * 32);
buf5[i].d = (unsigned long long)0xffffffffffffffff ^ (unsigned long long)(i * 64);
buf5[i].a = (uint8_t)0xff ^ (uint8_t)i;
buf5[i].b = (uint16_t)0xffff ^ (uint16_t)(i * 16);
buf5[i].c = (uint32_t)0xffffffff ^ (uint32_t)(i * 32);
buf5[i].d = (uint64_t)0xffffffffffffffff ^ (uint64_t)(i * 64);
}
H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5);

View File

@ -15,24 +15,24 @@ GROUP "/" {
DATATYPE H5T_STD_B16LE
DATASPACE SIMPLE { ( 32 ) / ( 32 ) }
DATA {
(0): ff:ff, 00:00, ef:ff, 00:00, df:ff, 00:00, cf:ff, 00:00, bf:ff,
(9): 00:00, af:ff, 00:00, 9f:ff, 00:00, 8f:ff, 00:00, 7f:ff, 00:00,
(18): 6f:ff, 00:00, 5f:ff, 00:00, 4f:ff, 00:00, 3f:ff, 00:00, 2f:ff,
(27): 00:00, 1f:ff, 00:00, 0f:ff, 00:00
(0): ff:ff, ef:ff, df:ff, cf:ff, bf:ff, af:ff, 9f:ff, 8f:ff, 7f:ff,
(9): 6f:ff, 5f:ff, 4f:ff, 3f:ff, 2f:ff, 1f:ff, 0f:ff, ff:fe, ef:fe,
(18): df:fe, cf:fe, bf:fe, af:fe, 9f:fe, 8f:fe, 7f:fe, 6f:fe, 5f:fe,
(27): 4f:fe, 3f:fe, 2f:fe, 1f:fe, 0f:fe
}
}
DATASET "bitfield_3" {
DATATYPE H5T_STD_B32LE
DATASPACE SIMPLE { ( 32 ) / ( 32 ) }
DATA {
(0): ff:ff:ff:ff, 00:00:00:00, df:ff:ff:ff, 00:00:00:00,
(4): bf:ff:ff:ff, 00:00:00:00, 9f:ff:ff:ff, 00:00:00:00,
(8): 7f:ff:ff:ff, 00:00:00:00, 5f:ff:ff:ff, 00:00:00:00,
(12): 3f:ff:ff:ff, 00:00:00:00, 1f:ff:ff:ff, 00:00:00:00,
(16): ff:fe:ff:ff, 00:00:00:00, df:fe:ff:ff, 00:00:00:00,
(20): bf:fe:ff:ff, 00:00:00:00, 9f:fe:ff:ff, 00:00:00:00,
(24): 7f:fe:ff:ff, 00:00:00:00, 5f:fe:ff:ff, 00:00:00:00,
(28): 3f:fe:ff:ff, 00:00:00:00, 1f:fe:ff:ff, 00:00:00:00
(0): ff:ff:ff:ff, df:ff:ff:ff, bf:ff:ff:ff, 9f:ff:ff:ff,
(4): 7f:ff:ff:ff, 5f:ff:ff:ff, 3f:ff:ff:ff, 1f:ff:ff:ff,
(8): ff:fe:ff:ff, df:fe:ff:ff, bf:fe:ff:ff, 9f:fe:ff:ff,
(12): 7f:fe:ff:ff, 5f:fe:ff:ff, 3f:fe:ff:ff, 1f:fe:ff:ff,
(16): ff:fd:ff:ff, df:fd:ff:ff, bf:fd:ff:ff, 9f:fd:ff:ff,
(20): 7f:fd:ff:ff, 5f:fd:ff:ff, 3f:fd:ff:ff, 1f:fd:ff:ff,
(24): ff:fc:ff:ff, df:fc:ff:ff, bf:fc:ff:ff, 9f:fc:ff:ff,
(28): 7f:fc:ff:ff, 5f:fc:ff:ff, 3f:fc:ff:ff, 1f:fc:ff:ff
}
}
DATASET "bitfield_4" {
@ -282,10 +282,10 @@ GROUP "/" {
}
DATASPACE SIMPLE { ( 32 ) / ( 32 ) }
DATA {
(0): ff:ff, 00:00, ef:ff, 00:00, df:ff, 00:00, cf:ff, 00:00, bf:ff,
(9): 00:00, af:ff, 00:00, 9f:ff, 00:00, 8f:ff, 00:00, 7f:ff, 00:00,
(18): 6f:ff, 00:00, 5f:ff, 00:00, 4f:ff, 00:00, 3f:ff, 00:00, 2f:ff,
(27): 00:00, 1f:ff, 00:00, 0f:ff, 00:00
(0): ff:ff, ef:ff, df:ff, cf:ff, bf:ff, af:ff, 9f:ff, 8f:ff, 7f:ff,
(9): 6f:ff, 5f:ff, 4f:ff, 3f:ff, 2f:ff, 1f:ff, 0f:ff, ff:fe, ef:fe,
(18): df:fe, cf:fe, bf:fe, af:fe, 9f:fe, 8f:fe, 7f:fe, 6f:fe, 5f:fe,
(27): 4f:fe, 3f:fe, 2f:fe, 1f:fe, 0f:fe
}
}
}

Binary file not shown.