summaryrefslogtreecommitdiffstats
path: root/kpat/freecell-solver/ms_ca.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitc90c389a8a8d9d8661e9772ec4144c5cf2039f23 (patch)
tree6d8391395bce9eaea4ad78958617edb20c6a7573 /kpat/freecell-solver/ms_ca.h
downloadtdegames-c90c389a8a8d9d8661e9772ec4144c5cf2039f23.tar.gz
tdegames-c90c389a8a8d9d8661e9772ec4144c5cf2039f23.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kpat/freecell-solver/ms_ca.h')
-rw-r--r--kpat/freecell-solver/ms_ca.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/kpat/freecell-solver/ms_ca.h b/kpat/freecell-solver/ms_ca.h
new file mode 100644
index 00000000..5c1b44ec
--- /dev/null
+++ b/kpat/freecell-solver/ms_ca.h
@@ -0,0 +1,33 @@
+/*
+ * ms_ca.h - A header file for a (possibly inline) function that compactly
+ * allocates a move stack.
+ *
+ * Written by Shlomi Fish (shlomif@vipe.technion.ac.il), 2002
+ *
+ * This file is in the public domain (it's uncopyrighted).
+ * */
+
+#include "inline.h"
+
+static GCC_INLINE fcs_move_stack_t * freecell_solver_move_stack_compact_allocate(freecell_solver_hard_thread_t * hard_thread, fcs_move_stack_t * old_move_stack_to_parent)
+{
+ char * ptr;
+ fcs_move_stack_t * new_move_stack_to_parent;
+ fcs_move_t * new_moves_to_parent;
+
+ fcs_compact_alloc_typed_ptr_into_var(
+ ptr,
+ char,
+ hard_thread->move_stacks_allocator,
+ (sizeof(fcs_move_stack_t) + sizeof(fcs_move_t)*old_move_stack_to_parent->num_moves)
+ );
+ new_move_stack_to_parent = (fcs_move_stack_t *)ptr;
+ new_moves_to_parent = (fcs_move_t *)(ptr+sizeof(fcs_move_stack_t));
+ new_move_stack_to_parent->moves = new_moves_to_parent;
+ new_move_stack_to_parent->num_moves =
+ new_move_stack_to_parent->max_num_moves =
+ old_move_stack_to_parent->num_moves;
+ memcpy(new_moves_to_parent, old_move_stack_to_parent->moves, sizeof(fcs_move_t)*old_move_stack_to_parent->num_moves);
+ return new_move_stack_to_parent;
+}
+