Commits

Shlomi Fish committed db3509e

Convert to fc-solve's GCC_INLINE.

  • Participants
  • Parent commits 6001a45
  • Branches make-code-suitable-for-fc-solve

Comments (0)

Files changed (5)

patsolve/config.h

 #define NTPILES 4       /* number of T cells */
 #endif
 
-#ifdef __GNUC__
-#define INLINE inline
-#else
-#define INLINE
-#endif
-
 #define DEBUG 0
 
 #ifdef WIN32
 #include <sys/types.h>
 #include "config.h"
 
+#include "inline.h"
+
 #define FNV1_32_INIT 0x811C9DC5
 #define FNV_32_PRIME 0x01000193
 
 
 /* Hash a buffer. */
 
-static INLINE u_int32_t fnv_hash_buf(u_char *s, int len)
+static GCC_INLINE u_int32_t fnv_hash_buf(u_char *s, int len)
 {
 	int i;
 	u_int32_t h;
 
 /* Hash a 0 terminated string. */
 
-static INLINE u_int32_t fnv_hash_str(u_char *s)
+static GCC_INLINE u_int32_t fnv_hash_str(u_char *s)
 {
 	u_int32_t h;
 

patsolve/inline.h

+/* Copyright (c) 2000 Shlomi Fish
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+/*
+ * inline.h - the purpose of this file is to define the GCC_INLINE
+ * macro.
+ *
+ */
+
+#ifndef FC_SOLVE__INLINE_H
+#define FC_SOLVE__INLINE_H
+
+#include "config.h"
+
+#if defined(HAVE_C_INLINE)
+#define GCC_INLINE FCS_INLINE_KEYWORD
+#elif defined(__GNUC__)
+#define GCC_INLINE inline
+#else
+#define GCC_INLINE
+#endif
+
+
+#endif
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
+
+#include "inline.h"
+
 #include "pat.h"
 #include "fnv.h"
 #include "tree.h"
 static int get_possible_moves(fc_solve_soft_thread_t * soft_thread, int *, int *);
 static void mark_irreversible(fc_solve_soft_thread_t * soft_thread, int n);
 static void win(fc_solve_soft_thread_t * soft_thread, POSITION *pos);
-static INLINE int get_pilenum(fc_solve_soft_thread_t * soft_thread, int w);
+static GCC_INLINE int get_pilenum(fc_solve_soft_thread_t * soft_thread, int w);
 
 /* Hash a pile. */
 
-static INLINE void hashpile(fc_solve_soft_thread_t * soft_thread, int w)
+static GCC_INLINE void hashpile(fc_solve_soft_thread_t * soft_thread, int w)
 {
 	soft_thread->W[w][soft_thread->Wlen[w]] = 0;
 	soft_thread->Whash[w] = fnv_hash_str(soft_thread->W[w]);
 /* This utility routine is used to check if a card is ever moved in
 a sequence of moves. */
 
-static INLINE int cardmoved(card_t card, MOVE **mpp, int j)
+static GCC_INLINE int cardmoved(card_t card, MOVE **mpp, int j)
 {
 	int i;
 
 /* This utility routine is used to check if a card is ever used as a
 destination in a sequence of moves. */
 
-static INLINE int cardisdest(card_t card, MOVE **mpp, int j)
+static GCC_INLINE int cardisdest(card_t card, MOVE **mpp, int j)
 {
 	int i;
 
 
 /* Automove logic.  Freecell games must avoid certain types of automoves. */
 
-static INLINE int good_automove(fc_solve_soft_thread_t * soft_thread, int o, int r)
+static GCC_INLINE int good_automove(fc_solve_soft_thread_t * soft_thread, int o, int r)
 {
 	int i;
 
 
 /* Comparison function for sorting the soft_thread->W piles. */
 
-static INLINE int wcmp(fc_solve_soft_thread_t * soft_thread, int a, int b)
+static GCC_INLINE int wcmp(fc_solve_soft_thread_t * soft_thread, int a, int b)
 {
 	if (soft_thread->Xparam[9] < 0) {
 		return soft_thread->Wpilenum[b] - soft_thread->Wpilenum[a];       /* newer piles first */
 }
 
 #if 0
-static INLINE int wcmp(int a, int b)
+static GCC_INLINE int wcmp(int a, int b)
 {
 	if (soft_thread->Xparam[9] < 0) {
 		return soft_thread->Wlen[b] - soft_thread->Wlen[a];       /* longer piles first */
 a hash bucket that contains a short list of piles, along with their
 identifiers. */
 
-static INLINE int get_pilenum(fc_solve_soft_thread_t * soft_thread, int w)
+static GCC_INLINE int get_pilenum(fc_solve_soft_thread_t * soft_thread, int w)
 {
 	int bucket, pilenum;
 	BUCKETLIST *l, *last;
 
 #include <stdio.h>
 #include <stdlib.h>
+
+#include "inline.h"
+
 #include "util.h"
 #include "pat.h"
 #include "tree.h"
 static void give_back_block(u_char *p);
 static BLOCK *new_block(fc_solve_soft_thread_t * soft_thread);
 
-static INLINE int CMP(fc_solve_soft_thread_t * soft_thread, u_char *a, u_char *b)
+static GCC_INLINE int CMP(fc_solve_soft_thread_t * soft_thread, u_char *a, u_char *b)
 {
 	return memcmp(a, b, soft_thread->Pilebytes);
 }