1 /*- 2 * Copyright (c) 2018 VMware, Inc. All Rights Reserved. 3 * 4 * SPDX-License-Identifier: (BSD-2-Clause AND GPL-2.0) 5 * 6 * $FreeBSD$ 7 */ 8 9 /* Some common utilities used by the VMCI kernel module. */ 10 11 #ifndef _VMCI_KERNEL_DEFS_H_ 12 #define _VMCI_KERNEL_DEFS_H_ 13 14 #include <sys/param.h> 15 #include <sys/systm.h> 16 17 typedef uint32_t PPN; 18 19 #define ASSERT(cond) KASSERT(cond, ("")) 20 #define ASSERT_ON_COMPILE(e) _Static_assert(e, #e); 21 22 #define LIKELY(_exp) __builtin_expect(!!(_exp), 1) 23 #define UNLIKELY(_exp) __builtin_expect((_exp), 0) 24 25 #define CONST64U(c) c##uL 26 27 #define ARRAYSIZE(a) (sizeof(a) / sizeof(*(a))) 28 29 #define ROUNDUP(x, y) (((x) + (y) - 1) / (y) * (y)) 30 #define CEILING(x, y) (((x) + (y) - 1) / (y)) 31 32 #endif /* !_VMCI_KERNEL_DEFS_H_ */ 33