xref: /aosp_15_r20/external/minigbm/util.h (revision d95af8df99a05bcb8679a54dc3ab8e5cd312b38e)
1 /*
2  * Copyright 2014 The Chromium OS Authors. All rights reserved.
3  * Use of this source code is governed by a BSD-style license that can be
4  * found in the LICENSE file.
5  */
6 
7 #ifndef UTIL_H
8 #define UTIL_H
9 
10 #define MAX(A, B) ((A) > (B) ? (A) : (B))
11 #define ARRAY_SIZE(A) (sizeof(A) / sizeof(*(A)))
12 #define PUBLIC __attribute__((visibility("default")))
13 #define ALIGN(A, B) (((A) + (B) - 1) & ~((B) - 1))
14 #define IS_ALIGNED(A, B) (ALIGN((A), (B)) == (A))
15 #define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
16 #define STRINGIZE_NO_EXPANSION(x) #x
17 #define STRINGIZE(x) STRINGIZE_NO_EXPANSION(x)
18 
19 #endif
20