1 | /** |
2 | * Copyright (c) Glow Contributors. See CONTRIBUTORS file. |
3 | * |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | * you may not use this file except in compliance with the License. |
6 | * You may obtain a copy of the License at |
7 | * |
8 | * http://www.apache.org/licenses/LICENSE-2.0 |
9 | * |
10 | * Unless required by applicable law or agreed to in writing, software |
11 | * distributed under the License is distributed on an "AS IS" BASIS, |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. |
15 | */ |
16 | #ifndef GLOW_SUPPORT_COMPILER_H |
17 | #define GLOW_SUPPORT_COMPILER_H |
18 | |
19 | #include <stdio.h> |
20 | |
21 | #if !defined(__has_builtin) |
22 | #define __has_builtin(builtin) 0 |
23 | #endif |
24 | |
25 | #ifdef _WIN32 |
26 | #define glow_aligned_malloc(p, a, s) \ |
27 | (((*(p)) = _aligned_malloc((s), (a))), *(p) ? 0 : errno) |
28 | #define glow_aligned_free(p) _aligned_free(p) |
29 | #else |
30 | #define glow_aligned_malloc(p, a, s) posix_memalign(p, a, s) |
31 | #define glow_aligned_free(p) free(p) |
32 | #endif |
33 | |
34 | #endif // GLOW_SUPPORT_COMPILER_H |
35 | |