| Index: base/numerics/saturated_arithmetic_arm.h
|
| diff --git a/third_party/WebKit/Source/wtf/asm/SaturatedArithmeticARM.h b/base/numerics/saturated_arithmetic_arm.h
|
| similarity index 78%
|
| rename from third_party/WebKit/Source/wtf/asm/SaturatedArithmeticARM.h
|
| rename to base/numerics/saturated_arithmetic_arm.h
|
| index 9d0e7e43f26978a6568bf467bdcfb6e3b0389a12..345a00773bc0c88fe3472ece52afc79999f7484c 100644
|
| --- a/third_party/WebKit/Source/wtf/asm/SaturatedArithmeticARM.h
|
| +++ b/base/numerics/saturated_arithmetic_arm.h
|
| @@ -1,15 +1,15 @@
|
| -// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef SaturatedArithmeticARM_h
|
| -#define SaturatedArithmeticARM_h
|
| +#ifndef BASE_NUMERICS_SATURATED_ARITHMETIC_ARM_H_
|
| +#define BASE_NUMERICS_SATURATED_ARITHMETIC_ARM_H_
|
|
|
| -#include "wtf/CPU.h"
|
| #include <limits>
|
| -#include <stdint.h>
|
|
|
| -ALWAYS_INLINE int32_t saturatedAddition(int32_t a, int32_t b) {
|
| +namespace base {
|
| +
|
| +inline int32_t SaturatedAddition(int32_t a, int32_t b) {
|
| int32_t result;
|
|
|
| asm("qadd %[output],%[first],%[second]"
|
| @@ -19,7 +19,7 @@ ALWAYS_INLINE int32_t saturatedAddition(int32_t a, int32_t b) {
|
| return result;
|
| }
|
|
|
| -ALWAYS_INLINE int32_t saturatedSubtraction(int32_t a, int32_t b) {
|
| +inline int32_t SaturatedSubtraction(int32_t a, int32_t b) {
|
| int32_t result;
|
|
|
| asm("qsub %[output],%[first],%[second]"
|
| @@ -29,23 +29,23 @@ ALWAYS_INLINE int32_t saturatedSubtraction(int32_t a, int32_t b) {
|
| return result;
|
| }
|
|
|
| -ALWAYS_INLINE int32_t saturatedNegative(int32_t a) {
|
| - return saturatedSubtraction(0, a);
|
| +inline int32_t SaturatedNegative(int32_t a) {
|
| + return SaturatedSubtraction(0, a);
|
| }
|
|
|
| -inline int getMaxSaturatedSetResultForTesting(int FractionalShift) {
|
| +inline int GetMaxSaturatedSetResultForTesting(int fractional_shift) {
|
| // For ARM Asm version the set function maxes out to the biggest
|
| // possible integer part with the fractional part zero'd out.
|
| // e.g. 0x7fffffc0.
|
| - return std::numeric_limits<int>::max() & ~((1 << FractionalShift) - 1);
|
| + return std::numeric_limits<int>::max() & ~((1 << fractional_shift) - 1);
|
| }
|
|
|
| -inline int getMinSaturatedSetResultForTesting(int FractionalShift) {
|
| +inline int GetMinSaturatedSetResultForTesting(int fractional_shift) {
|
| return std::numeric_limits<int>::min();
|
| }
|
|
|
| template <int FractionalShift>
|
| -ALWAYS_INLINE int saturatedSet(int value) {
|
| +inline int SaturatedSet(int value) {
|
| // Figure out how many bits are left for storing the integer part of
|
| // the fixed point number, and saturate our input to that
|
| enum { Saturate = 32 - FractionalShift };
|
| @@ -70,7 +70,7 @@ ALWAYS_INLINE int saturatedSet(int value) {
|
| }
|
|
|
| template <int FractionalShift>
|
| -ALWAYS_INLINE int saturatedSet(unsigned value) {
|
| +inline int SaturatedSet(unsigned value) {
|
| // Here we are being passed an unsigned value to saturate,
|
| // even though the result is returned as a signed integer. The ARM
|
| // instruction for unsigned saturation therefore needs to be given one
|
| @@ -97,4 +97,6 @@ ALWAYS_INLINE int saturatedSet(unsigned value) {
|
| return result;
|
| }
|
|
|
| -#endif // SaturatedArithmeticARM_h
|
| +} // namespace base
|
| +
|
| +#endif // BASE_NUMERICS_SATURATED_ARITHMETIC_ARM_H_
|
|
|