Skip to content

Commit

Permalink
Make MIN_ALIGN a const to allow better optimization
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dotdash authored and thestinger committed Oct 25, 2014
1 parent a10917a commit 6c18e50
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/liballoc/heap.rs
Expand Up @@ -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 {
Expand Down

0 comments on commit 6c18e50

Please sign in to comment.