Shlomi Fish avatar Shlomi Fish committed 9a4acf4

More struct members moving and implement st_idx_ptr.

git-svn-id: file:///home/shlomif/Backup/svn-dumps/google-code/svnsync-repos/fc-solve/trunk@3487 e7e8a897-7ba4-4ee7-b36f-f4c66519b19a

Comments (0)

Files changed (1)

fc-solve/source/instance.h

 {
     fc_solve_instance_t * instance;
 
-    int num_soft_threads;
     struct fc_solve_soft_thread_struct * soft_threads;
 
     /*
     int num_times;
 
     /*
-     * The maximal limit for this variable.
+     * The maximal limit for num_times.
      * */
     int max_num_times;
 
      * The index for the soft-thread that is currently processed
      * */
     int st_idx;
-
-    /*
-     * A counter that determines how many of the soft threads that belong
-     * to this hard thread have already finished. If it becomes num_soft_threads
-     * this thread is skipped.
-     * */
-    int num_soft_threads_finished;
-
     /*
      * This is the mechanism used to allocate memory for stacks, states
      * and move stacks.
     char indirect_stacks_buffer[1];
 #endif
 
-    char * prelude_as_string;
-
     int prelude_num_items;
     int prelude_idx;
     fcs_prelude_item_t * prelude;
 
     fcs_bool_t allocated_from_list;
+    int num_soft_threads;
+ 
+    /*
+     * A counter that determines how many of the soft threads that belong
+     * to this hard thread have already finished. If it becomes num_soft_threads
+     * this thread is skipped.
+     * */
+    int num_soft_threads_finished;
+
+   char * prelude_as_string;
 };
 
 
     int num_times_started_at;
     int ret;
     fc_solve_instance_t * instance = hard_thread->instance;
+    int * st_idx_ptr = &(hard_thread->st_idx);
     /*
      * Again, making sure that not all of the soft_threads in this
      * hard thread are finished.
     ret = FCS_STATE_SUSPEND_PROCESS;
     while(hard_thread->num_soft_threads_finished < hard_thread->num_soft_threads)
     {
-        soft_thread = &(hard_thread->soft_threads[hard_thread->st_idx]);
+        soft_thread = &(hard_thread->soft_threads[*st_idx_ptr]);
         /*
          * Move to the next thread if it's already finished
          * */
             if ((hard_thread->prelude != NULL) &&    \
                 (hard_thread->prelude_idx < hard_thread->prelude_num_items))   \
             {      \
-                hard_thread->st_idx = hard_thread->prelude[hard_thread->prelude_idx].scan_idx; \
+                (*st_idx_ptr) = hard_thread->prelude[hard_thread->prelude_idx].scan_idx; \
                 hard_thread->num_times_left_for_soft_thread = hard_thread->prelude[hard_thread->prelude_idx].quota; \
                 hard_thread->prelude_idx++; \
             }    \
             else       \
             {       \
-                hard_thread->st_idx++;      \
-                if (hard_thread->st_idx == hard_thread->num_soft_threads)     \
+                if ((++(*st_idx_ptr)) == hard_thread->num_soft_threads)     \
                 {       \
-                    hard_thread->st_idx = 0;    \
+                    *(st_idx_ptr) = 0;  \
                 }      \
-                hard_thread->num_times_left_for_soft_thread = hard_thread->soft_threads[hard_thread->st_idx].num_times_step;  \
+                hard_thread->num_times_left_for_soft_thread = hard_thread->soft_threads[*st_idx_ptr].num_times_step;  \
             }
 
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.