From 660188264dee3c8f3510e2e24c11816c6b60f197 Mon Sep 17 00:00:00 2001 From: Andreas Gampe Date: Mon, 5 May 2014 20:47:19 -0700 Subject: ART: Use utils.h::RoundUp instead of explicit bit-fiddling Change-Id: I249a2cfeb044d3699d02e13d42b8e72518571640 --- compiler/dex/quick/codegen_util.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'compiler/dex/quick/codegen_util.cc') diff --git a/compiler/dex/quick/codegen_util.cc b/compiler/dex/quick/codegen_util.cc index 9f84e098d9..de13a2ee69 100644 --- a/compiler/dex/quick/codegen_util.cc +++ b/compiler/dex/quick/codegen_util.cc @@ -558,7 +558,7 @@ static int AssignLiteralOffsetCommon(LIR* lir, CodeOffset offset) { static int AssignLiteralPointerOffsetCommon(LIR* lir, CodeOffset offset, unsigned int element_size) { // Align to natural pointer size. - offset = (offset + (element_size - 1)) & ~(element_size - 1); + offset = RoundUp(offset, element_size); for (; lir != NULL; lir = lir->next) { lir->offset = offset; offset += element_size; @@ -758,7 +758,7 @@ int Mir2Lir::AssignFillArrayDataOffset(CodeOffset offset) { tab_rec->offset = offset; offset += tab_rec->size; // word align - offset = (offset + 3) & ~3; + offset = RoundUp(offset, 4); } return offset; } @@ -1049,14 +1049,13 @@ size_t Mir2Lir::GetNumBytesForCompilerTempSpillRegion() { int Mir2Lir::ComputeFrameSize() { /* Figure out the frame size */ - static const uint32_t kAlignMask = kStackAlignment - 1; uint32_t size = num_core_spills_ * GetBytesPerGprSpillLocation(cu_->instruction_set) + num_fp_spills_ * GetBytesPerFprSpillLocation(cu_->instruction_set) + sizeof(uint32_t) // Filler. + (cu_->num_regs + cu_->num_outs) * sizeof(uint32_t) + GetNumBytesForCompilerTempSpillRegion(); /* Align and set */ - return (size + kAlignMask) & ~(kAlignMask); + return RoundUp(size, kStackAlignment); } /* -- cgit v1.2.3-59-g8ed1b