security/sandbox/chromium/base/float_util.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/security/sandbox/chromium/base/float_util.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,36 @@
     1.4 +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
     1.5 +// Use of this source code is governed by a BSD-style license that can be
     1.6 +// found in the LICENSE file.
     1.7 +
     1.8 +#ifndef BASE_FLOAT_UTIL_H_
     1.9 +#define BASE_FLOAT_UTIL_H_
    1.10 +
    1.11 +#include "build/build_config.h"
    1.12 +
    1.13 +#include <float.h>
    1.14 +
    1.15 +#include <cmath>
    1.16 +
    1.17 +namespace base {
    1.18 +
    1.19 +template <typename Float>
    1.20 +inline bool IsFinite(const Float& number) {
    1.21 +#if defined(OS_POSIX)
    1.22 +  return std::isfinite(number) != 0;
    1.23 +#elif defined(OS_WIN)
    1.24 +  return _finite(number) != 0;
    1.25 +#endif
    1.26 +}
    1.27 +
    1.28 +template <typename Float>
    1.29 +inline bool IsNaN(const Float& number) {
    1.30 +#if defined(OS_POSIX)
    1.31 +  return std::isnan(number) != 0;
    1.32 +#elif defined(OS_WIN)
    1.33 +  return _isnan(number) != 0;
    1.34 +#endif
    1.35 +}
    1.36 +
    1.37 +}  // namespace base
    1.38 +
    1.39 +#endif  // BASE_FLOAT_UTIL_H_

mercurial