64 bit types and C libraries

Mandel mandel at no.no
Tue May 22 07:27:54 PDT 2007


Regan Heath Wrote:

> This seems like the right time to ask if anyone else is having a go at it, or wants to give me a hand.
...maybe you like to join the IRC channel #d on freenode.net. :-)
In my opinion it's good for simple questions, this NG is very good for the harder ones.

> In the meantime I have reached a point where a type PQ_64BIT is used.  Looking at the headers it appears this type is defined differently for each system/compiler based on whether they have a 64 bit type, so on windows using M$ compilers etc it is __int64 for example.  In the rest of cases it is a custom BIGNUM struct.
> My question is this.. what the heck do I put in my D port when I see this type used?
I think you can go with long/ulong. Since the size is fixed for D, the compiler does the job emulating a 64 integer on systems where int is smaller 32bits.
The NEWS file of the openssl source package mentions that BIGNUM
is optimized for special tasks, probably optimizations the D compiler couldn't figure out.
Imho it's a good idea to use long/long for now and to postpone this optimization for such (more rare) systems. Maybe the D compilers can do this on it's own, I did not took a look a the BIGNUM yet.

good luck!


More information about the Digitalmars-d-learn mailing list