Coverage Report

Created: 2025-10-28 07:11

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