Comments: 9
beachbum811 [2015-05-03 20:07:00 +0000 UTC]
what do people use bitwise operators for?
It seems overly complicated to me.
👍: 0 ⏩: 1
Doom-the-wolf In reply to beachbum811 [2015-05-03 20:16:46 +0000 UTC]
There are reasons, but they aren't particularly important for beginners. You can multiply or divide an integer by 2 using the << and >> operators. It's faster than using the * operator.
Sometimes a programmer uses the 32 bits of an integer as boolean values to save space. So you can use VALUE = A&(1<
You can use bitwise operators to separate color values from a hexadecimal number. Colors in Flash are stored in a hexadecimal number 0xAARRGGBB, where A,R,G and B represent alpha, red, green and blue digits. You can retrieve the alpha by using ALPHA = (COLOR>>24)&0xFF or green by using GREEN = (COLOR>>8)&0xFF.
👍: 0 ⏩: 0
beachbum811 [2015-04-17 01:52:58 +0000 UTC]
what does &= do?
👍: 0 ⏩: 1
Doom-the-wolf In reply to beachbum811 [2015-04-17 02:24:48 +0000 UTC]
It's a way to shorten a commonly used operation. A&=B is the same as writing A=A&B
I believe the & (bitwise and) operator is already explained in this tutorial.
👍: 0 ⏩: 0
Barn-flakes [2011-06-25 15:59:07 +0000 UTC]
Begging your pardon, but I think subtract and assign should be [-=] not [+=]. Sorry to nit-pick.
👍: 0 ⏩: 1
Doom-the-wolf In reply to Barn-flakes [2011-06-25 16:07:35 +0000 UTC]
That's right. I made a mistake when copying the text. I'll fix it now.
👍: 0 ⏩: 0
Rumakashi [2011-06-11 12:08:13 +0000 UTC]
On the 3rd exercise I forgot about 0 being the first number that should be used. Beside that I did pretty well knowledge wise. I just need to remember what operators does what...I guess I should make flash cards or something and just study the hell out of them until I know them by heart. For now I think I will skip the Bitwise stuff until I remember everything else.
Once again thanks for making this.
👍: 0 ⏩: 1
Doom-the-wolf In reply to Rumakashi [2011-06-11 12:12:40 +0000 UTC]
The most useful ones are: +,-,* and / for math operations. Then <, ==, != and > for comparing values. Most of these should be familiar from Math class.
👍: 0 ⏩: 1
Rumakashi In reply to Doom-the-wolf [2011-06-11 14:32:11 +0000 UTC]
Of course. I kinda want to learn everything though. Don't want to end up writing something complex where there may be a operation that do all of the work for me.
👍: 0 ⏩: 0