mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 18:08:40 +02:00
mesa/macros: move ALIGN_NPOT to macros.h
Aligning with a non-power-of-two number is a general task that can be used in
various places. This commit is required for the next one.
v2: add greater than 0 assertion (Anuj).
convert the macro to a static inline function.
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
This commit is contained in:
parent
97f4efd573
commit
54d2aa4258
2 changed files with 10 additions and 6 deletions
|
|
@ -44,12 +44,6 @@
|
||||||
|
|
||||||
#define INTEL_UPLOAD_SIZE (64*1024)
|
#define INTEL_UPLOAD_SIZE (64*1024)
|
||||||
|
|
||||||
/**
|
|
||||||
* Like ALIGN(), but works with a non-power-of-two alignment.
|
|
||||||
*/
|
|
||||||
#define ALIGN_NPOT(value, alignment) \
|
|
||||||
(((value) + (alignment) - 1) / (alignment) * (alignment))
|
|
||||||
|
|
||||||
void
|
void
|
||||||
intel_upload_finish(struct brw_context *brw)
|
intel_upload_finish(struct brw_context *brw)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -697,6 +697,16 @@ ALIGN(uintptr_t value, int32_t alignment)
|
||||||
return (((value) + (alignment) - 1) & ~((alignment) - 1));
|
return (((value) + (alignment) - 1) & ~((alignment) - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Like ALIGN(), but works with a non-power-of-two alignment.
|
||||||
|
*/
|
||||||
|
static inline uintptr_t
|
||||||
|
ALIGN_NPOT(uintptr_t value, int32_t alignment)
|
||||||
|
{
|
||||||
|
assert(alignment > 0);
|
||||||
|
return (value + alignment - 1) / alignment * alignment;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Align a value down to an alignment value
|
* Align a value down to an alignment value
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue