I need to pass ~0L
to my function, how can I do this, no matter what I do ~0 is being turned to -1
This is the C code:
812 int result = GetProperty(window, property_name,
813 (~0L), // (all of them)
814 &type, &format, &num_items, &properties);
This is my jsctypes:
var result = GetProperty(window, property_name, ctypes.long(~0), type.address(), format.address(), num_items.address(), properties.address()
Notice the ctypes.long(~0)
how to make this be the 111111111111111111111111111111
for 32bit slash the 64 1's for 64bit?
Thanks
reference topic: What does (~0L) mean?
Solution was to use ctypes.long(~0)
this is good for 32 bit and 64 bit :) Thanks to @arai.
21:45 noida how to use ~0L in jsctypes?
22:07 arai noida: 32bit or 64bit?
22:11 noida can you show me how to do for both plz
22:17 arai noida: I guess ctypes.int32_t(~0) and ctypes.int64_t(~0) will work
22:20 noida -0x80000000
22:20 noida that wont work huh?
22:20 arai it uses ctypes.long for the parameter, so ctypes.long(~0) would be better
22:23 arai ~0L is 0xFFFFFFFFFFFFFFFF, right?
22:24 noida i thought it was: 0x7ffffff
22:29 arai
printf("%lx\n", ~0L);
outputs "ffffffffffffffff"22:31 arai it would be more better to use
ctypes.long(~0)
for consistency22:33 noida also using the long method will be cross 64/32 bit right?
22:37 arai "This automatically converts to an Int64 JavaScript object on all platforms, since it's unknown whether this is a 32-bit or 64-bit value. This is done for compatibility's sake."
22:37 arai https://developer.mozilla.org/en-US/docs/Mozilla/js-ctypes/js-ctypes_reference/ctypes