SA-MP Forums [Include] rBits [supports 16, 8, 4, 2 and 1-bit arrays]
 New Account Members List Search Today's Posts Mark Forums Read

 08/08/2011, 04:38 PM #11 Zh3r0 High-roller   Join Date: Mar 2008 Posts: 4,513 Reputation: 398 Re: rBits [supports 16, 8, 4, 2 and 1-bit arrays] Does this work with enums? Forgot to question this. __________________
 08/08/2011, 04:54 PM #12 Double-O-Seven Guest   Posts: n/a Re: rBits [supports 16, 8, 4, 2 and 1-bit arrays] How about this: pawn Code: `bitLim = ((1 << (1 << _: bitShift)) - 1)//Case Bit1: (1 << (1 << 0) - 1 =  (1 << 1) - 1 = 2 - 1 = 1 is correct!//Case Bit2: (1 << (1 << 1) - 1 =  (1 << 2) - 1 = 4 - 1 = 3 is correct!//Case Bit4: (1 << (1 << 2) - 1 =  (1 << 4) - 1 = 16 - 1 = 15 is correct!//Case Bit8: (1 << (1 << 3) - 1 =  (1 << 8) - 1 = 256 - 1 = 255 is correct!//Case Bit16: (1 << (1 << 4) - 1 =  (1 << 16) - 1 = 65536 - 1 = 65535 is correct!//I had to test it because I wasn't sure 100% test.//OK; Now I'm sure because a shift is a multiplication by 2. And 1 << x == 2 ^ x where ^ denotes power.` Instead of this: pawn Code: `bitLim = ((1 << floatround(floatpower(2.0, _: bitShift))) - 1)`
 08/08/2011, 05:06 PM #13 Zh3r0 High-roller   Join Date: Mar 2008 Posts: 4,513 Reputation: 398 Re: rBits [supports 16, 8, 4, 2 and 1-bit arrays] Can anyone answer my question? I'm kinda in a hurry, thanks. __________________
 08/08/2011, 05:08 PM #14 vyper Huge Clucker     Join Date: Jul 2009 Location: Hell. x_x Posts: 276 Reputation: 68 Re: rBits [supports 16, 8, 4, 2 and 1-bit arrays] Great include I gonna use it thanks
 08/08/2011, 05:14 PM #15 OUL Big Clucker   Join Date: Jun 2011 Posts: 89 Reputation: 2 Re: rBits [supports 16, 8, 4, 2 and 1-bit arrays] One more question, what about YSI - ybit's are that work on this way too? And how to use 'if' statement with this rBits (if i can use) or i need to make something like this evry time? pawn Code: `IsAVariable ( playerid ) return Bit1_Get ( iVariable, playerid );`
08/08/2011, 05:21 PM   #16
Double-O-Seven
Guest

Posts: n/a
Re: rBits [supports 16, 8, 4, 2 and 1-bit arrays]

Quote:
 Originally Posted by OUL One more question, what about YSI - ybit's are that work on this way too? And how to use 'if' statement with this rBits (if i can use) or i need to make something like this evry time? pawn Code: `IsAVariable ( playerid ) return Bit1_Get ( iVariable, playerid );`
y_bit only supports BitArrays (1bit-arrays, Bit1 in this include).
For if-statements: if (BitX_Get (...)) { /*do something*/ }...

 08/08/2011, 05:22 PM #17 OUL Big Clucker   Join Date: Jun 2011 Posts: 89 Reputation: 2 Re: rBits [supports 16, 8, 4, 2 and 1-bit arrays] Thanks, then very good work Ryder Is BitGet in boolean type? so i can use: pawn Code: `if( BitN_Get ( iVariable, playerid ) == false/true)`
08/08/2011, 05:23 PM   #18
RyDeR`
High-roller

Join Date: Feb 2009
Location: Belgium
Posts: 2,929
Reputation: 700
Re: rBits [supports 16, 8, 4, 2 and 1-bit arrays]

Quote:
 Originally Posted by Zh3r0 Does this work with enums? Forgot to question this.
What do you exactly mean. Give me an example with normal arrays.

Quote:
 Originally Posted by Double-O-Seven How about this: pawn Code: `bitLim = ((1 << (1 << _: bitShift)) - 1)//Case Bit1: (1 << (1 << 0) - 1 =  (1 << 1) - 1 = 2 - 1 = 1 is correct!//Case Bit2: (1 << (1 << 1) - 1 =  (1 << 2) - 1 = 4 - 1 = 3 is correct!//Case Bit4: (1 << (1 << 2) - 1 =  (1 << 4) - 1 = 16 - 1 = 15 is correct!//Case Bit8: (1 << (1 << 3) - 1 =  (1 << 8) - 1 = 256 - 1 = 255 is correct!//Case Bit16: (1 << (1 << 4) - 1 =  (1 << 16) - 1 = 65536 - 1 = 65535 is correct!//I had to test it because I wasn't sure 100% test.//OK; Now I'm sure because a shift is a multiplication by 2. And 1 << x == 2 ^ x where ^ denotes power.` Instead of this: pawn Code: `bitLim = ((1 << floatround(floatpower(2.0, _: bitShift))) - 1)`
That's even better! Changing right now, thanks.
__________________

Sup?

 08/08/2011, 05:26 PM #19 OUL Big Clucker   Join Date: Jun 2011 Posts: 89 Reputation: 2 Re: rBits [supports 16, 8, 4, 2 and 1-bit arrays] Ryder @enums pawn Code: `enum iData { SomeVar };new     PlayerInfo[MAX_PLAYERS][iData];` How to use in that case rBit?
08/08/2011, 05:26 PM   #20
Zh3r0
High-roller

Join Date: Mar 2008
Posts: 4,513
Reputation: 398
Re: rBits [supports 16, 8, 4, 2 and 1-bit arrays]

Quote:
 Originally Posted by RyDeR` What do you exactly mean. Give me an example with normal arrays. That's even better! Changing right now, thanks.
I mean, I have an enum, and want to use the enum.

pawn Code:
`enum pData { level, etc, etc2 };new Pi[MAX_PLAYERS][pData];`

That's an example, how do I do it with enums?

@OUL Same time, sorry

@Edit, How do I increment or decrease a value?
Ah, nevermind, I use bitx_get() + 1. Right?
__________________

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post gamer931215 Includes 122 19/05/2014 03:54 PM Ouch_Charlie General 3 14/05/2011 03:30 PM [FilterScript] [FS] ezConverter - Now supports CreateVehicle! Rzzr Filterscripts 13 16/03/2010 10:25 PM DracoBlue Filterscripts 261 20/10/2009 11:20 AM

All times are GMT. The time now is 08:33 PM.

 -- (EN) English -- (RU) Русски SA-MP - Archive - Top