]> git.lizzy.rs Git - rust.git/commitdiff
rt: Fix alignment in debug_opaque
authorLuqman Aden <laden@csclub.uwaterloo.ca>
Wed, 13 Feb 2013 20:41:04 +0000 (15:41 -0500)
committerLuqman Aden <laden@csclub.uwaterloo.ca>
Wed, 13 Feb 2013 20:41:38 +0000 (15:41 -0500)
src/rt/rust_builtin.cpp

index a8e1e7a0be4ba5b82d5c17276c4f4db268bac190..3f6545caaa8e47d56470d873afc5b8014324b5a9 100644 (file)
@@ -241,13 +241,12 @@ debug_opaque(type_desc *t, uint8_t *front) {
     rust_task *task = rust_get_current_task();
     LOG(task, stdlib, "debug_opaque");
     debug_tydesc_helper(t);
+    // Account for alignment. `front` may not indeed be the
+    // front byte of the passed-in argument
+    if (((uintptr_t)front % t->align) != 0) {
+        front = (uint8_t *)align_to((uintptr_t)front, (size_t)t->align);
+    }
     for (uintptr_t i = 0; i < t->size; ++front, ++i) {
-
-        // Account for alignment. `front` may not indeed be the
-        // front byte of the passed-in argument
-        if (((uintptr_t)front % t->align) != 0)
-            front = (uint8_t *)align_to((uintptr_t)front, (size_t)t->align);
-
         LOG(task, stdlib, "  byte %" PRIdPTR ": 0x%" PRIx8, i, *front);
     }
 }