mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-05-01 21:23:59 +00:00
The plus and minor have the same level of precedence. The Misra-C considers it as a violation. Added brackets in between addition and substraction oprators. Signed-off-by: Yang, Yu-chu <yu-chu.yang@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com>
28 lines
629 B
C
28 lines
629 B
C
/*
|
|
* Copyright (C) 2018 Intel Corporation. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#ifndef UTIL_H
|
|
#define UTIL_H
|
|
|
|
/** Add an offset (in bytes) to an (base)address.
|
|
*
|
|
* @param addr Baseaddress
|
|
* @param off Offset
|
|
* @return Returns baseaddress + offset in bytes.
|
|
*/
|
|
#define ADD_OFFSET(addr, off) (void *)(((uint8_t *)(addr))+(off))
|
|
|
|
#define offsetof(st, m) __builtin_offsetof(st, m)
|
|
|
|
/** Roundup (x/y) to ( x/y + (x%y) ? 1 : 0) **/
|
|
#define INT_DIV_ROUNDUP(x, y) ((((x)+(y))-1)/(y))
|
|
|
|
#define min(x, y) ((x) < (y)) ? (x) : (y)
|
|
|
|
#define max(x, y) ((x) < (y)) ? (y) : (x)
|
|
|
|
#endif /* UTIL_H */
|