[squeak-dev] 64 bit FFI

K K Subbu kksubbu.ml at gmail.com
Thu May 28 17:06:44 UTC 2020


On 12/03/20 5:51 pm, Nicolas Cellier wrote:
> FFI has ExternalType signedLongLong or just 'longlong' and
> ExternalType unsignedLongLong or 'ulonglong' which are 64 bits on all
> architectures.
C is one of my favorite programming languages (for speed) but its types 
are horrible. I prefer explicit names like uint8, int8 etc, particularly 
for low level operations like bit shifts or holding persistent data. E.g.,

#if sizeof(int) == 32
typedef int int32;
#endif
#if sizeof(long) == 32
typedef long int32;
#endif

Also something like:

#define _nullp		((char *)0)
#define s2p(aSize)	((void *)(_nullp + (int)aSize))
#define p2s(aPointer)	((char *)(aPointer) - _nullp)

takes care of the integer/pointer mix up warnings.

Regards .. Subbu


More information about the Squeak-dev mailing list