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