Index: dod.c
===================================================================
RCS file: /cvs/public/parrot/dod.c,v
retrieving revision 1.13
diff -u -r1.13 dod.c
--- dod.c	17 Aug 2002 01:11:08 -0000	1.13
+++ dod.c	17 Aug 2002 20:14:49 -0000
@@ -334,8 +334,7 @@
 {
     size_t lo_var_ptr = (size_t)interpreter->lo_var_ptr;
     size_t hi_var_ptr = (size_t)&lo_var_ptr;
-    ptrdiff_t cur_var_ptr;
-    ptrdiff_t direction = (hi_var_ptr > lo_var_ptr) ? 1 : -1;
+    size_t cur_var_ptr;
 
     size_t buffer_min = get_min_buffer_address(interpreter);
     size_t buffer_max = get_max_buffer_address(interpreter);
@@ -345,15 +344,30 @@
     if (!lo_var_ptr)
         return last;
     
-    for (cur_var_ptr = lo_var_ptr;
-         (ptrdiff_t)(cur_var_ptr * direction) < (ptrdiff_t)(hi_var_ptr * direction);
-         cur_var_ptr = (size_t)( (ptrdiff_t)cur_var_ptr + direction * PARROT_PTR_ALIGNMENT )
-         ) {
-        size_t ptr = *(size_t *)cur_var_ptr;
-        if (pmc_min <= ptr && ptr < pmc_max && is_pmc_ptr(interpreter,(void *)ptr)) {
-            last = mark_used((PMC *)ptr, last);
-        } else if (buffer_min <= ptr && ptr < buffer_max && is_buffer_ptr(interpreter,(void *)ptr)) {
-            buffer_lives((Buffer *)ptr);
+    if (hi_var_ptr > lo_var_ptr) {
+        for (cur_var_ptr = lo_var_ptr;
+             cur_var_ptr < hi_var_ptr;
+             cur_var_ptr = (size_t)( (ptrdiff_t)cur_var_ptr + PARROT_PTR_ALIGNMENT )
+             ) {
+            size_t ptr = *(size_t *)cur_var_ptr;
+            if (pmc_min <= ptr && ptr < pmc_max && is_pmc_ptr(interpreter,(void *)ptr)) {
+                last = mark_used((PMC *)ptr, last);
+            } else if (buffer_min <= ptr && ptr < buffer_max && is_buffer_ptr(interpreter,(void *)ptr)) {
+                buffer_lives((Buffer *)ptr);
+            }
+        }
+    }
+    else {
+        for (cur_var_ptr = lo_var_ptr;
+             cur_var_ptr > hi_var_ptr;
+             cur_var_ptr = (size_t)( (ptrdiff_t)cur_var_ptr - PARROT_PTR_ALIGNMENT )
+             ) {
+            size_t ptr = *(size_t *)cur_var_ptr;
+            if (pmc_min <= ptr && ptr < pmc_max && is_pmc_ptr(interpreter,(void *)ptr)) {
+                last = mark_used((PMC *)ptr, last);
+            } else if (buffer_min <= ptr && ptr < buffer_max && is_buffer_ptr(interpreter,(void *)ptr)) {
+                buffer_lives((Buffer *)ptr);
+            }
         }
     }
     return last;
