454 return align_size_up(offset, HeapWordsPerLong); |
454 return align_size_up(offset, HeapWordsPerLong); |
455 } |
455 } |
456 |
456 |
457 inline void* align_pointer_up(const void* addr, size_t size) { |
457 inline void* align_pointer_up(const void* addr, size_t size) { |
458 return (void*) align_size_up_((uintptr_t)addr, size); |
458 return (void*) align_size_up_((uintptr_t)addr, size); |
|
459 } |
|
460 |
|
461 // Align down with a lower bound. If the aligning results in 0, return 'alignment'. |
|
462 |
|
463 inline size_t align_size_down_bounded(size_t size, size_t alignment) { |
|
464 size_t aligned_size = align_size_down_(size, alignment); |
|
465 return aligned_size > 0 ? aligned_size : alignment; |
459 } |
466 } |
460 |
467 |
461 // Clamp an address to be within a specific page |
468 // Clamp an address to be within a specific page |
462 // 1. If addr is on the page it is returned as is |
469 // 1. If addr is on the page it is returned as is |
463 // 2. If addr is above the page_address the start of the *next* page will be returned |
470 // 2. If addr is above the page_address the start of the *next* page will be returned |