« first day (679 days earlier)      last day (1749 days later) » 

3:21 PM
hey guys
i'm using c# and don't have much experience with bitwise operations
gist: 4413201, 2012-12-30 15:08:25Z
public static long encode(IEnumerable<int> cards)
  	{
			long result = 0;
			foreach(int c in cards)
			{
				result |= encode(new Card(c));
			}
			return result;
		}

public static long encode(Card c)
		{
			return 0x1L << ((int) c.Suit*16 + (int) c.Rank);
		}
how could I decode the cards again?
this is basically a method to encode many cards in a single 64bit variable
 
5 messages moved from Lounge<C++>
 

« first day (679 days earlier)      last day (1749 days later) »