quimao Posted September 21, 2020 Posted September 21, 2020 Somebody please explain to me ,when I try Bitshift with the same input in python and autoit. They have given different results python print(1600707826 << 24) autoit BitShift(1600707826,-24) tested on win 7 64
TheXman Posted September 21, 2020 Posted September 21, 2020 (edited) The most likely reason in this case is because, in AutoIt, bit operations are performed as 32-bit integers. Your result will definitely be outside the range of a 32-bit integer. The highlighted information was taken from the BitShift function entry in the AutoIt Help File. This should illustrate the issue. Const $INT = 1600707826 ConsoleWrite(StringFormat("Value in hex = %X (%i)", $INT, $INT) & @CRLF) ConsoleWrite(StringFormat("Value << 24 in hex = %X (%i)", BitShift($INT, -24), BitShift($INT, -24)) & @CRLF) Output Value in hex = 5F68DCF2 (1600707826) Value << 24 in hex = F2000000 (-234881024) Of course the correct answer is: 005F 68DC F200 0000 (26,855,420,949,692,416) If you want to do 64-bit bit operations, you may want to check out the topic below... Edited September 21, 2020 by TheXman quimao 1 CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now