OLD | NEW |
| (Empty) |
1 // Copyright (c) 2016, the Dartino project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE.md file. | |
4 | |
5 #ifndef PLATFORMS_STM_DISCO_FLETCH_SRC_GLOBALS_H_ | |
6 #define PLATFORMS_STM_DISCO_FLETCH_SRC_GLOBALS_H_ | |
7 | |
8 // Use 4kb pages. | |
9 #define PAGE_SIZE_SHIFT 12 | |
10 #define PAGE_SIZE (1 << PAGE_SIZE_SHIFT) | |
11 | |
12 #define MAX(a, b) ((a) > (b) ? (a) : (b)) | |
13 #define MIN(a, b) ((a) < (b) ? (a) : (b)) | |
14 #define ROUNDUP(a, b) (((a) + ((b) - 1)) & ~((b) - 1)) | |
15 #define ROUNDDOWN(a, b) ((a) & ~((b) - 1)) | |
16 #define ALIGN(a, b) ROUNDUP(a, b) | |
17 #define IS_ALIGNED(a, b) (!(((uintptr_t)(a)) & (((uintptr_t)(b)) - 1))) | |
18 #define PAGE_ALIGN(x) ALIGN(x, PAGE_SIZE) | |
19 #define IS_PAGE_ALIGNED(x) IS_ALIGNED(x, PAGE_SIZE) | |
20 | |
21 #endif // PLATFORMS_STM_DISCO_FLETCH_SRC_GLOBALS_H_ | |
OLD | NEW |