From da4d79bc9a4aeb9da7c6259ce4c9c1c3bf545eb8 Mon Sep 17 00:00:00 2001 From: Roland Levillain Date: Tue, 24 Mar 2015 14:36:11 +0000 Subject: Unify ART's various implementations of bit_cast. ART had several implementations of art::bit_cast: 1. one in runtime/base/casts.h, declared as: template inline Dest bit_cast(const Source& source); 2. another one in runtime/utils.h, declared as: template static inline V bit_cast(U in); 3. and a third local version, in runtime/memory_region.h, similar to the previous one: template static Destination MemoryRegion::local_bit_cast(Source in); This CL removes versions 2. and 3. and changes their callers to use 1. instead. That version was chosen over the others as: - it was the oldest one in the code base; and - its syntax was closer to the standard C++ cast operators, as it supports the following use: bit_cast(source) since `Source' can be deduced from `source'. Change-Id: I7334fd5d55bf0b8a0c52cb33cfbae6894ff83633 --- compiler/optimizing/code_generator.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'compiler/optimizing/code_generator.h') diff --git a/compiler/optimizing/code_generator.h b/compiler/optimizing/code_generator.h index ecaa6f0123..07ca6b1ccf 100644 --- a/compiler/optimizing/code_generator.h +++ b/compiler/optimizing/code_generator.h @@ -271,7 +271,7 @@ class CodeGenerator { return 0; } else { DCHECK(constant->IsFloatConstant()); - return bit_cast(constant->AsFloatConstant()->GetValue()); + return bit_cast(constant->AsFloatConstant()->GetValue()); } } @@ -281,12 +281,12 @@ class CodeGenerator { } else if (constant->IsNullConstant()) { return 0; } else if (constant->IsFloatConstant()) { - return bit_cast(constant->AsFloatConstant()->GetValue()); + return bit_cast(constant->AsFloatConstant()->GetValue()); } else if (constant->IsLongConstant()) { return constant->AsLongConstant()->GetValue(); } else { DCHECK(constant->IsDoubleConstant()); - return bit_cast(constant->AsDoubleConstant()->GetValue()); + return bit_cast(constant->AsDoubleConstant()->GetValue()); } } -- cgit v1.2.3-59-g8ed1b