[Nexus-developers] NeXus-64 bit

Mark Koennecke Mark.Koennecke at psi.ch
Thu Aug 23 15:09:53 BST 2007


Hi everyone,

I now got 64 bit integers working for NeXus for HDF-5 and XML. It 
required changes to  several
bindings too. And we are entering a ball of mud:

Contrary to my  expectations I had to notice that a long on an Intel-PC 
is 32bit only and not 64bit.
On an alpha a long is sufficient to get a 64 bit integer.  It would be 
interesting to test this on a
64-bit Intel, but I have none available. In order to get a 64 bit 
integer on 32 bit Intel you need a
long long type. But long long is C99 standard. As this is not yet 50 
years old, there might be
platforms/compilers out there which cannot do this. Well, I worked 
around this. Partially I
used tests for sizeof(long) in order to get the right thing done. But I 
also had to create a new
define, NX64INT, which must be initailized to the correct number type on 
the current platform.
I currently have some logic in napi.h to do this, but this could also be 
done by a compiler
option automatically determined by the configure script.

The question I want answered before I commit this is:
- The 64 bit integers  introduces platform problems. Do we still want this?

As an aggravating factor I extended napi_test.c and thus all the 
automatic tests "fail" now.
Sorry, Freddie.  I also  fixed the #16 issue with \0 terminated strings 
in XML. 
Given the complications stated above and the fact that I am not 
convinced that Freddies
suggestion would solve the 64 bit byte order issue, there is no support 
for 64 bit ints in
HDF-4 as of now. It would anyway be ugly, because we would need to 
annotate HDF-4 pseudo
64 bit 32 bit datasets in some way to distinguish them.  Freddie 
suggested some tricky stuff with
bit shifting but I believe the difference between BE and LE is in which 
direction to shift in order
to get the low bytes out.

             What do you think?

                            Mark
 



More information about the NeXus-developers mailing list