Choose integer size
Posted: 31 Dec 2017, 16:40
It would be nice to be able to choose and stick with the size of an integer for a variable, because ahk automatically changing them can make them difficult to work with when doing bitwise operations. Simple example and current workaround:
Thanks
Code: Select all
msgbox, % ~~-1 ;-1 is 0xFFFFFFFFFFFFFFFF. ~ that is 0x00000000. ~ that is 0xFFFFFFFF
;workaround:
; x := -1
; is64Bit := x < 0 OR x > 0xFFFFFFFF
; y := ~~x
; if(is64Bit AND y >= 0 AND y <= 0xFFFFFFFF)
; {
; y |= 0x7FFFFFFF00000000
; y := y << 1 >> 1 ;the negative bit is special for some reason
; }
; msgbox, % y