Jump to content

BitAnd with unsigned 32 bit integers


Recommended Posts

Because a signed value to a integer run from -2,147,483,648 to 2,147,483,647 in a 32 bit system and unsigned value run from 0 to 4,294,967,295 in a 32 bit system. There a multiple way to add on to bit, I would search "Inifinite Bits" in a search engine to get your information as it would be just as easy to inplement them in here

0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E

Link to comment
Share on other sites

I am having problems with the Bit*** functions because they work with signed integers and I need to work with unsigned integers. Is there a recommended workaround for this problem?

"Signed" and "unsigned" do not mean anything to the Bit* functions. It only changes the way they are displayed in decimal. As long as you are doing either bit operations with Bit* (or maybe some Binary*) functions, and not mixing that with math or String* operations, you will be fine:
$binVar = 0x7FFFFFFF
ConsoleWrite("$binVar = " & $binVar & @LF)
ConsoleWrite("Hex = " & "0x" & Hex($binVar, 8) & @LF)
$binVar = BitOR(0x80000000, $binVar)
ConsoleWrite("$binVar = " & $binVar & @LF)
ConsoleWrite("Hex = " & "0x" & Hex($binVar, 8) & @LF)
$binVar = BitAND(0xF0F0F0F0, $binVar)
ConsoleWrite("$binVar = " & $binVar & @LF)
ConsoleWrite("Hex = " & "0x" & Hex($binVar, 8) & @LF)
$binVar = BitXOR(0xFFFFFFFF, $binVar)
ConsoleWrite("$binVar = " & $binVar & @LF)
ConsoleWrite("Hex = " & "0x" & Hex($binVar, 8) & @LF)

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...