Stéphane Marchesin | 25a2606 | 2014-09-12 16:18:59 -0700 | [diff] [blame] | 1 | /* |
Daniele Castagna | 7a755de | 2016-12-16 17:32:30 -0500 | [diff] [blame] | 2 | * Copyright 2014 The Chromium OS Authors. All rights reserved. |
Stéphane Marchesin | 25a2606 | 2014-09-12 16:18:59 -0700 | [diff] [blame] | 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)) |
Gurchetan Singh | 1b1d56a | 2017-03-10 16:25:23 -0800 | [diff] [blame] | 11 | #define ARRAY_SIZE(A) (sizeof(A) / sizeof(*(A))) |
Stéphane Marchesin | 25a2606 | 2014-09-12 16:18:59 -0700 | [diff] [blame] | 12 | #define PUBLIC __attribute__((visibility("default"))) |
Kristian H. Kristensen | e8778f0 | 2018-04-04 14:21:41 -0700 | [diff] [blame] | 13 | #define ALIGN(A, B) (((A) + (B)-1) & ~((B)-1)) |
| 14 | #define IS_ALIGNED(A, B) (ALIGN((A), (B)) == (A)) |
Gurchetan Singh | 1b1d56a | 2017-03-10 16:25:23 -0800 | [diff] [blame] | 15 | #define DIV_ROUND_UP(n, d) (((n) + (d)-1) / (d)) |
Gurchetan Singh | cf9ed9d | 2019-12-13 09:37:01 -0800 | [diff] [blame] | 16 | #define STRINGIZE_NO_EXPANSION(x) #x |
| 17 | #define STRINGIZE(x) STRINGIZE_NO_EXPANSION(x) |
Stéphane Marchesin | 25a2606 | 2014-09-12 16:18:59 -0700 | [diff] [blame] | 18 | |
| 19 | #endif |