security/sandbox/chromium/base/float_util.h

Wed, 31 Dec 2014 07:16:47 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:16:47 +0100
branch
TOR_BUG_9701
changeset 3
141e0f1194b1
permissions
-rw-r--r--

Revert simplistic fix pending revisit of Mozilla integration attempt.

michael@0 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
michael@0 2 // Use of this source code is governed by a BSD-style license that can be
michael@0 3 // found in the LICENSE file.
michael@0 4
michael@0 5 #ifndef BASE_FLOAT_UTIL_H_
michael@0 6 #define BASE_FLOAT_UTIL_H_
michael@0 7
michael@0 8 #include "build/build_config.h"
michael@0 9
michael@0 10 #include <float.h>
michael@0 11
michael@0 12 #include <cmath>
michael@0 13
michael@0 14 namespace base {
michael@0 15
michael@0 16 template <typename Float>
michael@0 17 inline bool IsFinite(const Float& number) {
michael@0 18 #if defined(OS_POSIX)
michael@0 19 return std::isfinite(number) != 0;
michael@0 20 #elif defined(OS_WIN)
michael@0 21 return _finite(number) != 0;
michael@0 22 #endif
michael@0 23 }
michael@0 24
michael@0 25 template <typename Float>
michael@0 26 inline bool IsNaN(const Float& number) {
michael@0 27 #if defined(OS_POSIX)
michael@0 28 return std::isnan(number) != 0;
michael@0 29 #elif defined(OS_WIN)
michael@0 30 return _isnan(number) != 0;
michael@0 31 #endif
michael@0 32 }
michael@0 33
michael@0 34 } // namespace base
michael@0 35
michael@0 36 #endif // BASE_FLOAT_UTIL_H_

mercurial