mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-08-05 10:14:04 +00:00
[common] array: add ALIGN_PAD macro for common logic
ALIGN_PAD(x, a) returns x rounded up to the nearest multiple of a.
This commit is contained in:
@@ -22,5 +22,6 @@
|
||||
#define _LG_ARRAY_H_
|
||||
|
||||
#define ARRAY_LENGTH(arr) (sizeof(arr) / sizeof(*(arr)))
|
||||
#define ALIGN_PAD(value, align) (((value) + (align) - 1) & -(align))
|
||||
|
||||
#endif
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "common/array.h"
|
||||
#include "common/debug.h"
|
||||
#include "common/option.h"
|
||||
#include "common/sysinfo.h"
|
||||
@@ -232,7 +233,7 @@ int ivshmemGetDMABuf(struct IVSHMEM * dev, uint64_t offset, uint64_t size)
|
||||
(struct IVSHMEMInfo *)dev->opaque;
|
||||
|
||||
// align to the page size
|
||||
size = (size + pageSize - 1) & -pageSize;
|
||||
size = ALIGN_PAD(size, pageSize);
|
||||
|
||||
const struct kvmfr_dmabuf_create create =
|
||||
{
|
||||
|
Reference in New Issue
Block a user