AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Bitwise Shift Operators (https://forums.alliedmods.net/showthread.php?t=126739)

z-@T 05-13-2010 03:07

Bitwise Shift Operators
 
Hey, guys, nice to meet you that's my first post here, but anyway let's go directly to the problem: Can someone please explain me a little more "simple" maybe, what those bitwise shift operators are used for?

When I read the pawn tutorial I saw what they do and an example, but I still can't understand what exacly are they and for what I could use them. I am asking for help about this, because I never thought I would need something like this but I seem to see them in use in almost every plugin I see.

Generally I ask for help because I see this almost everywhere and I don't understand it:

Code:

#define KEYS (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)
I can see it's for the menu...but as I said earlier...

Exolent[jNr] 05-13-2010 03:09

Re: Bitwise Shift Operators
 
http://forums.alliedmods.net/showthread.php?t=90507

z-@T 05-13-2010 04:42

Re: Bitwise Shift Operators
 
Thanks alot.

Bugsy 05-13-2010 16:31

Re: Bitwise Shift Operators
 
Imo, that page is poorly written for ppl trying to learn. Bit operators are not unique to AMXX so you can search google or wiki for the operators for help if you do not understand that tut.

wrecked_ 05-13-2010 16:37

Re: Bitwise Shift Operators
 
Quote:

Originally Posted by Bugsy (Post 1179365)
Imo, that page is poorly written for ppl trying to learn. Bit operators are not unique to AMXX so you can search google or wiki for the operators for help if you do not understand that tut.

Agreed. When I read that page a few months back, it confused me more than it taught me anything. The way it's explained and the situation it's used in is very impractical and he should've used a different example.

EDIT: After reading it over again, it makes much more sense to me than previously, but this is mainly due to me learning the bitshifts through seeing them used in other plugins. It's still very confusing for beginners.

Bugsy 05-13-2010 17:54

Re: Bitwise Shift Operators
 
I wrote a quite long and newb friendly bit tutorial that I never posted. I will prob touch it up a bit and post it as maybe a beginners bit tut.


All times are GMT -4. The time now is 03:56.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.