acrn-hypervisor/hypervisor/include/lib/macros.h
Shiqing Gao bcaede0c0e hv: treewide: fix 'Use of function like macro'
- convert function like macros to inline functions based on MISRA-C
  requirement
- remove some unused and duplicated macros

Tracked-On: #861
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2018-09-11 10:49:48 +08:00

23 lines
576 B
C

/*
* Copyright (C) 2018 Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef MACROS_H
#define MACROS_H
/** Replaces 'x' by the string "x". */
#define STRINGIFY(x) #x
/* Macro used to check if a value is aligned to the required boundary.
* Returns TRUE if aligned; FALSE if not aligned
* NOTE: The required alignment must be a power of 2 (2, 4, 8, 16, 32, etc)
*/
static inline bool mem_aligned_check(uint64_t value, uint64_t req_align)
{
return ((value & (req_align - 1UL)) == 0UL);
}
#endif /* INCLUDE_MACROS_H defined */