thanks. Didnt find this one. I was looking for constants in Int module and the global scope.
arne
schrieb:
Is it possible to fing the systems size of an int from within pike? I have to do some parsing of binary data and dont want to do it inside a cmod.
An int on most platforms nowadays is 32 bits/4 bytes.
To determine some of the characteristics of the Pike runtime you can call Pike.get_runtime_info():
32-bit Pike 7.8 on x86: | > Pike.get_runtime_info(); | (1) Result: ([ /* 6 elements */ | "abi": 32, | "auto_bignum": 1, | "bytecode_method": "ia32", | "float_size": 32, | "int_size": 32, | "native_byteorder": 1234 | ])
64-bit Pike 7.8 on sparc: | > Pike.get_runtime_info(); | (1) Result: ([ /* 6 elements */ | "abi": 64, | "auto_bignum": 1, | "bytecode_method": "sparc", | "float_size": 64, | "int_size": 64, | "native_byteorder": 4321 | ])
64-bit Pike 7.8 on x86_64: | > Pike.get_runtime_info(); | (1) Result: ([ /* 6 elements */ | "abi": 64, | "auto_bignum": 1, | "bytecode_method": "default", | "float_size": 64, | "int_size": 64, | "native_byteorder": 1234 | ])
int_size and float_size above indicate the sizes of the C-level types INT_TYPE and FLOAT_TYPE.