Skip to content

Commit d6d8c4a

Browse files
authored
previous patch was wrong.. (#1862)
1 parent 49ae092 commit d6d8c4a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/saverestore.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -462,16 +462,16 @@ bool_t xdr_set_gdl_pos(XDR *x, long int y){
462462
//if (next!=(cur+cLength)) cerr<<"problem:"<<cur+cLength<<":"<<next<<"\n";
463463
}
464464
xdr_set_gdl_pos(xdrs, cur-12); //ptrs0
465-
//copy next (64 bit) as two 32 bits. Should be OK on 32 bit machines as next is u_int64.
466-
if (!BigEndian()) { //first 32 bit is low, second high (XDRS is BigEndian)
465+
//we write a sort of BigEndian format
467466
U u;
468467
u.soixantequatre=next;
469-
u_int32_t temp=u.trentedeux[0];
470-
u.trentedeux[0]=u.trentedeux[1];
471-
u.trentedeux[1]=temp;
472-
next=u.soixantequatre;
473-
}
474-
xdr_uint64_t(xdrs, &next);
468+
if (BigEndian()) { //to be tested on BigEndian machines: may be some other logic at work?.
469+
xdr_uint32_t(xdrs, &(u.trentedeux[1])); // least significative bits at end ( < 4 GB)
470+
xdr_uint32_t(xdrs, &(u.trentedeux[0])); // for adresses > 4GB
471+
} else {
472+
xdr_uint32_t(xdrs, &(u.trentedeux[0])); //e.g. intel, little_endian 1st
473+
xdr_uint32_t(xdrs, &(u.trentedeux[1])); // this would be for adresses > 4GB
474+
}
475475
xdr_set_gdl_pos(xdrs, next);
476476
return next;
477477
}

0 commit comments

Comments
 (0)