Coverage Report

Created: 2025-07-11 06:13

/src/ots/subprojects/woff2-1.0.2/src/round.h
Line
Count
Source (jump to first uncovered line)
1
/* Copyright 2013 Google Inc. All Rights Reserved.
2
3
   Distributed under MIT license.
4
   See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
5
*/
6
7
/* Helper for rounding */
8
9
#ifndef WOFF2_ROUND_H_
10
#define WOFF2_ROUND_H_
11
12
#include <limits>
13
14
namespace woff2 {
15
16
// Round a value up to the nearest multiple of 4. Don't round the value in the
17
// case that rounding up overflows.
18
22.5k
template<typename T> T Round4(T value) {
19
22.5k
  if (std::numeric_limits<T>::max() - value < 3) {
20
0
    return value;
21
0
  }
22
22.5k
  return (value + 3) & ~3;
23
22.5k
}
unsigned long woff2::Round4<unsigned long>(unsigned long)
Line
Count
Source
18
22.5k
template<typename T> T Round4(T value) {
19
22.5k
  if (std::numeric_limits<T>::max() - value < 3) {
20
0
    return value;
21
0
  }
22
22.5k
  return (value + 3) & ~3;
23
22.5k
}
unsigned int woff2::Round4<unsigned int>(unsigned int)
Line
Count
Source
18
51
template<typename T> T Round4(T value) {
19
51
  if (std::numeric_limits<T>::max() - value < 3) {
20
0
    return value;
21
0
  }
22
51
  return (value + 3) & ~3;
23
51
}
24
25
} // namespace woff2
26
27
#endif  // WOFF2_ROUND_H_