about summary refs log tree commit diff
path: root/src/rt/rust_builtin.cpp
diff options
context:
space:
mode:
authorLuqman Aden <laden@csclub.uwaterloo.ca>2013-02-13 15:41:04 -0500
committerLuqman Aden <laden@csclub.uwaterloo.ca>2013-02-13 15:41:38 -0500
commit2c198561dd878dcfa4fca3b7785215fd3490ca84 (patch)
tree5ebd865d0151f14ca98239dd66ab14874c4aeb55 /src/rt/rust_builtin.cpp
parentc22d0af14c621a847e71dac7fe0e7fe19bf851a1 (diff)
downloadrust-2c198561dd878dcfa4fca3b7785215fd3490ca84.tar.gz
rust-2c198561dd878dcfa4fca3b7785215fd3490ca84.zip
rt: Fix alignment in debug_opaque
Diffstat (limited to 'src/rt/rust_builtin.cpp')
-rw-r--r--src/rt/rust_builtin.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp
index a8e1e7a0be4..3f6545caaa8 100644
--- a/src/rt/rust_builtin.cpp
+++ b/src/rt/rust_builtin.cpp
@@ -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);
     }
 }