summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authormateuszs <mateuszs@opera.com>2015-04-24 06:20:23 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-24 13:20:30 +0000
commit3371ab09fb14093f9f5f5db41a60d98b215217c1 (patch)
treeea9a957dc2f23cb0a80e85c44e2ac77c66b4cca7 /base
parent6fb4e15bef960a41144cb5abf366c1618afed07f (diff)
downloadchromium_src-3371ab09fb14093f9f5f5db41a60d98b215217c1.zip
chromium_src-3371ab09fb14093f9f5f5db41a60d98b215217c1.tar.gz
chromium_src-3371ab09fb14093f9f5f5db41a60d98b215217c1.tar.bz2
Removed obsolete float_util.h as VS2013 supports standards well enough.
BUG= Review URL: https://codereview.chromium.org/1076443002 Cr-Commit-Position: refs/heads/master@{#326781}
Diffstat (limited to 'base')
-rw-r--r--base/BUILD.gn1
-rw-r--r--base/base.gypi1
-rw-r--r--base/float_util.h36
-rw-r--r--base/json/json_parser.cc5
-rw-r--r--base/time/time.cc4
-rw-r--r--base/trace_event/trace_event_impl.cc6
-rw-r--r--base/values.cc4
7 files changed, 10 insertions, 47 deletions
diff --git a/base/BUILD.gn b/base/BUILD.gn
index 7750eee..710da4a 100644
--- a/base/BUILD.gn
+++ b/base/BUILD.gn
@@ -233,7 +233,6 @@ component("base") {
"files/scoped_file.h",
"files/scoped_temp_dir.cc",
"files/scoped_temp_dir.h",
- "float_util.h",
"format_macros.h",
"gtest_prod_util.h",
"guid.cc",
diff --git a/base/base.gypi b/base/base.gypi
index a45a387..bbc3f60 100644
--- a/base/base.gypi
+++ b/base/base.gypi
@@ -227,7 +227,6 @@
'files/scoped_file.h',
'files/scoped_temp_dir.cc',
'files/scoped_temp_dir.h',
- 'float_util.h',
'format_macros.h',
'gtest_prod_util.h',
'guid.cc',
diff --git a/base/float_util.h b/base/float_util.h
deleted file mode 100644
index 9027310..0000000
--- a/base/float_util.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) 2012 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 BASE_FLOAT_UTIL_H_
-#define BASE_FLOAT_UTIL_H_
-
-#include "build/build_config.h"
-
-#include <float.h>
-
-#include <cmath>
-
-namespace base {
-
-template <typename Float>
-inline bool IsFinite(const Float& number) {
-#if defined(OS_POSIX)
- return std::isfinite(number) != 0;
-#elif defined(OS_WIN)
- return _finite(number) != 0;
-#endif
-}
-
-template <typename Float>
-inline bool IsNaN(const Float& number) {
-#if defined(OS_POSIX)
- return std::isnan(number) != 0;
-#elif defined(OS_WIN)
- return _isnan(number) != 0;
-#endif
-}
-
-} // namespace base
-
-#endif // BASE_FLOAT_UTIL_H_
diff --git a/base/json/json_parser.cc b/base/json/json_parser.cc
index d42b1a3..e9a27bc 100644
--- a/base/json/json_parser.cc
+++ b/base/json/json_parser.cc
@@ -4,7 +4,8 @@
#include "base/json/json_parser.h"
-#include "base/float_util.h"
+#include <cmath>
+
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/strings/string_number_conversions.h"
@@ -872,7 +873,7 @@ Value* JSONParser::ConsumeNumber() {
double num_double;
if (base::StringToDouble(num_string.as_string(), &num_double) &&
- IsFinite(num_double)) {
+ std::isfinite(num_double)) {
return new FundamentalValue(num_double);
}
diff --git a/base/time/time.cc b/base/time/time.cc
index 321323b..bf6c998 100644
--- a/base/time/time.cc
+++ b/base/time/time.cc
@@ -4,12 +4,12 @@
#include "base/time/time.h"
+#include <cmath>
#include <ios>
#include <limits>
#include <ostream>
#include <sstream>
-#include "base/float_util.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/strings/stringprintf.h"
@@ -161,7 +161,7 @@ time_t Time::ToTimeT() const {
// static
Time Time::FromDoubleT(double dt) {
- if (dt == 0 || IsNaN(dt))
+ if (dt == 0 || std::isnan(dt))
return Time(); // Preserve 0 so we can tell it doesn't exist.
if (dt == std::numeric_limits<double>::infinity())
return Max();
diff --git a/base/trace_event/trace_event_impl.cc b/base/trace_event/trace_event_impl.cc
index 12f9598..cbeeeab 100644
--- a/base/trace_event/trace_event_impl.cc
+++ b/base/trace_event/trace_event_impl.cc
@@ -5,12 +5,12 @@
#include "base/trace_event/trace_event_impl.h"
#include <algorithm>
+#include <cmath>
#include "base/base_switches.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/debug/leak_annotations.h"
-#include "base/float_util.h"
#include "base/format_macros.h"
#include "base/json/string_escape.h"
#include "base/lazy_instance.h"
@@ -647,7 +647,7 @@ void TraceEvent::AppendValueAsJSON(unsigned char type,
// should be made into a common method.
std::string real;
double val = value.as_double;
- if (IsFinite(val)) {
+ if (std::isfinite(val)) {
real = DoubleToString(val);
// Ensure that the number has a .0 if there's no decimal or 'e'. This
// makes sure that when we read the JSON back, it's interpreted as a
@@ -665,7 +665,7 @@ void TraceEvent::AppendValueAsJSON(unsigned char type,
// "-.1" bad "-0.1" good
real.insert(1, "0");
}
- } else if (IsNaN(val)){
+ } else if (std::isnan(val)){
// The JSON spec doesn't allow NaN and Infinity (since these are
// objects in EcmaScript). Use strings instead.
real = "\"NaN\"";
diff --git a/base/values.cc b/base/values.cc
index 52876cf..0e1e2b1 100644
--- a/base/values.cc
+++ b/base/values.cc
@@ -7,9 +7,9 @@
#include <string.h>
#include <algorithm>
+#include <cmath>
#include <ostream>
-#include "base/float_util.h"
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/move.h"
@@ -175,7 +175,7 @@ FundamentalValue::FundamentalValue(int in_value)
FundamentalValue::FundamentalValue(double in_value)
: Value(TYPE_DOUBLE), double_value_(in_value) {
- if (!IsFinite(double_value_)) {
+ if (!std::isfinite(double_value_)) {
NOTREACHED() << "Non-finite (i.e. NaN or positive/negative infinity) "
<< "values cannot be represented in JSON";
double_value_ = 0.0;