Hello
can some one tell me the meaning of this for loop
for (i=0;i<52;i++)
deck[i]= 0| [i/13] | ((i%13) << 2 ) | (! (i/26) << 6 );
i am not familiar with bit manipulations. so any help would be greatly appreciated.
thanks
radhika
Printable View
Hello
can some one tell me the meaning of this for loop
for (i=0;i<52;i++)
deck[i]= 0| [i/13] | ((i%13) << 2 ) | (! (i/26) << 6 );
i am not familiar with bit manipulations. so any help would be greatly appreciated.
thanks
radhika
ok it is creating an array with with the loop going from 0 to 52
and putting thta equation into english
deck[i]= 0 Or [i divided by 13] Or ((i Modulus 13) shift left 2 bits ) Or (not (i divided by 26) shift left 6 bit )
modulus in case you dont know returns the remander after dividing those 2 numbers.
even in plain english that is still pretty confusing..:p
now the brackets are 1/13 im not sure of. perhaps it converts to a byte..or something..Cant be certain. Im still learning all these operators myself.