Thread: onwall and such
View Single Post
  #37  
Old 05-21-2006, 11:01 AM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by jake13jake
Tell me, why would you write
if( (x==2) || (x==3) || (x==5) || (x==7) )

When you could write

if( (1<<x) & ((1<<2)|(1<<3)|(1<<5)|(1<<7) )

I'll tell you what though, I've only been recently learning how to use bitwise operators.
If you are using the new engine...
NPC Code:
if (x in {1, 2, 3, 5, 7})

__________________
Skyld