about summary refs log tree commit diff
path: root/src/liballoc/heap.rs
diff options
context:
space:
mode:
authorBjörn Steinbrink <bsteinbr@gmail.com>2014-10-24 11:08:42 +0200
committerDaniel Micay <danielmicay@gmail.com>2014-10-25 12:33:27 -0400
commit6c18e508f10aa5bf42dc80691654b9cde2a661cd (patch)
tree12153d93343fbcbdc537b2e063af557dc08727bc /src/liballoc/heap.rs
parenta10917a6a9b087d10ac4fd0186b719218627281e (diff)
downloadrust-6c18e508f10aa5bf42dc80691654b9cde2a661cd.tar.gz
rust-6c18e508f10aa5bf42dc80691654b9cde2a661cd.zip
Make MIN_ALIGN a const to allow better optimization
With MIN_ALIGN as a static, other crates don't have access to its value
at compile time, because it is an extern global. That means that the
checks against it can't be optimized out, which is rather unfortunate.
So let's make it a constant instead.
Diffstat (limited to 'src/liballoc/heap.rs')
-rw-r--r--src/liballoc/heap.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/liballoc/heap.rs b/src/liballoc/heap.rs
index 5a0f860ff84..0e5aca18ec7 100644
--- a/src/liballoc/heap.rs
+++ b/src/liballoc/heap.rs
@@ -112,10 +112,10 @@ unsafe fn exchange_free(ptr: *mut u8, size: uint, align: uint) {
 #[cfg(any(target_arch = "arm",
           target_arch = "mips",
           target_arch = "mipsel"))]
-static MIN_ALIGN: uint = 8;
+const MIN_ALIGN: uint = 8;
 #[cfg(any(target_arch = "x86",
           target_arch = "x86_64"))]
-static MIN_ALIGN: uint = 16;
+const MIN_ALIGN: uint = 16;
 
 #[cfg(jemalloc)]
 mod imp {