示例#1
0
static void 
doMaskRankTable(void) {
  int i;

  MakeTable_begin("StdDeck_maskRankTable", 
                  MR_FILENAME, 
                  "StdDeck_CardMask", 
                  StdDeck_Rank_COUNT);
  MakeTable_comment(MR_COMMENT_STRING);
  for (i=0; i < StdDeck_Rank_COUNT; i++) {
    StdDeck_CardMask c;

    StdDeck_CardMask_RESET(c);
    c.cards.spades   = (1 << i);
    c.cards.hearts   = (1 << i);
    c.cards.diamonds = (1 << i);
    c.cards.clubs    = (1 << i);

#ifdef HAVE_INT64
    MakeTable_outputUInt64(~c.cards_n);
#else
    { 
      char buf[80];
      sprintf(buf, " { { 0x%08x, 0x%08x } } ", ~c.cards_nn.n1, ~c.cards_nn.n2);
      MakeTable_outputString(buf);
    };
#endif
  };

  MakeTable_end();
}
示例#2
0
void 
MakeTable_outputUInt64(uint64 arg) {
  uint32 high, low;
  char buf[80];

  high = arg >> 32;
  low  = (uint32) arg;
#if defined(MSDOS)
  sprintf(buf, " { 0x%08x%08x } ", high, low);
#else
#if defined(WIN32) && !defined(__MINGW32__)
  sprintf(buf, " { 0x%08x%08xi64 } ", high, low);
#else
  sprintf(buf, " { 0x%08x%08xLL } ", high, low);
#endif
#endif
  MakeTable_outputString(buf);
}
示例#3
0
static void 
doCardMaskTable(void) {
  StdDeck_CardMask c;
  int i;

  MakeTable_begin("StdDeck_cardMasksTable", 
                  CM_FILENAME, 
                  "StdDeck_CardMask", 
                  StdDeck_N_CARDS);
  MakeTable_comment(CM_COMMENT_STRING);
  for (i=0; i<StdDeck_N_CARDS; i++) {
    int suit = StdDeck_SUIT(i);
    int rank = StdDeck_RANK(i);

    StdDeck_CardMask_RESET(c);
    if (suit == StdDeck_Suit_HEARTS)
      c.cards.hearts = (1 << rank);
    else if (suit == StdDeck_Suit_DIAMONDS)
      c.cards.diamonds = (1 << rank);
    else if (suit == StdDeck_Suit_CLUBS)
      c.cards.clubs = (1 << rank);
    else if (suit == StdDeck_Suit_SPADES)
      c.cards.spades = (1 << rank);

#ifdef HAVE_INT64
    MakeTable_outputUInt64(c.cards_n);
#else
    {
      char buf[80];
      sprintf(buf, " { { 0x%08x, 0x%08x } } ", c.cards_nn.n1, c.cards_nn.n2);
      MakeTable_outputString(buf);
    };
#endif
  };

  MakeTable_end();
}
示例#4
0
void 
MakeTable_outputUInt8(uint8 arg) {
  char buf[80];
  sprintf(buf, "0x%02x", arg);
  MakeTable_outputString(buf);
}