Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/gfx/layers/mlgpu/UtilityMLGPU.h
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
3
/* This Source Code Form is subject to the terms of the Mozilla Public
4
 * License, v. 2.0. If a copy of the MPL was not distributed with this
5
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
#ifndef mozilla_gfx_layers_mlgpu_UtilityMLGPU_h
8
#define mozilla_gfx_layers_mlgpu_UtilityMLGPU_h
9
10
#include "mozilla/Assertions.h"
11
#include "mozilla/MathAlgorithms.h"
12
13
namespace mozilla {
14
namespace layers {
15
16
template <size_t T> struct AlignUp
17
{
18
0
  static inline size_t calc(size_t aAmount) {
19
0
    MOZ_ASSERT(IsPowerOfTwo(T), "alignment must be a power of two");
20
0
    return aAmount + ((T - (aAmount % T)) % T);
21
0
  }
22
};
23
24
template <> struct AlignUp<0>
25
{
26
0
  static inline size_t calc(size_t aAmount) {
27
0
    return aAmount;
28
0
  }
29
};
30
31
} // namespace layers
32
} // namespace mozilla
33
34
#ifdef ENABLE_AL_LOGGING
35
#  define AL_LOG(...) printf_stderr("AL: " __VA_ARGS__)
36
#  define AL_LOG_IF(cond, ...) do { if (cond) { printf_stderr("AL: " __VA_ARGS__); } } while(0)
37
#else
38
#  define AL_LOG(...)
39
#  define AL_LOG_IF(...)
40
#endif
41
42
#endif // mozilla_gfx_layers_mlgpu_UtilityMLGPU_h