1 /* 2 * Copyright (C) 2017 The Android Open Source Project 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 ESE_SYSDEPS_H__ 17 #define ESE_SYSDEPS_H__ 1 18 19 #include <stdbool.h> /* bool */ 20 #include <stdint.h> /* uint*_t */ 21 22 #define ESE_UINT32_MAX (UINT32_MAX) 23 24 #ifndef NULL 25 #ifdef __cplusplus 26 #define NULL nullptr 27 #else 28 #define NULL ((void *)(0)) 29 #endif 30 #endif 31 32 /* Set visibility for exported functions. */ 33 #ifndef ESE_API 34 #define ESE_API __attribute__ ((visibility("default"))) 35 #endif /* ESE_API */ 36 37 /* Mimic C11 _Static_assert behavior for a C99 world. */ 38 #ifndef _static_assert 39 #define _static_assert(what, why) { while (!(1 / (!!(what)))); } 40 #endif 41 42 extern void *ese_memcpy(void *__dest, const void *__src, uint64_t __n); 43 extern void *ese_memset(void *__s, int __c, uint64_t __n); 44 45 extern uint32_t ese_be32toh(uint32_t big_endian_32bits); 46 extern uint32_t ese_htobe32(uint32_t host_32bits); 47 extern uint32_t ese_le32toh(uint32_t little_endian_32bits); 48 extern uint32_t ese_htole32(uint32_t host_32bits); 49 50 #endif /* ESE_SYSDEPS_H__ */ 51