Re: Bitwise operators?

Wrap the results in bin().  That will let you see the bits rather than the base 10 integer.

<< and >> are shifts and are generally an exception to the rule I'm about to explain.  << takes the string bin() returns and adds the specified number of 0s on the end.  >> chops off the specified rightmost digits.  These are effectively multiplication and divisions by powers of 2: x << n = x * (2**n), x >> n = x / (2**n).

The rest can be worked out by learning what they do to a single bit.  Once you know that, it does it to all bits in the arguments, assuming that any missing bits in the smaller number are 0.

You're confused because you don't know how to convert from base 10 to base 2 in your head.  I'd practice that some.  Also, you should practice going from base 2 to base 16.  Base 2 to base 16 (also known as hex) is actually easier, because unlike base 10 you can just consider the binary number 4 bits at a time and don't have to look at the others.  But I will leave you to the internet on that one, I don't particularly feel like typing a tutorial with a bunch of tables unless you really, really need me to.

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector

Reply via email to