treewide: Replace the usage of ALIGN to align64 or align for consistence behavior
Rational:
The input/result parameter of ALIGN is uintptr_t
, and people used it
over uint32_t/uint64_t/size_t/uintptr_t with same function.
This result the following inconsistence
- on 32 bit system, call ALIGN over
uint64_t
parameter willTRUNC
the input parameter - on 64 bit system, call ALIGN over
uint32_t
will returnuint64_t
and thenTRUNC
touint32_t
even though it's not hurt - call ALIGN over size/uintptr_t, but the
ALIGN
function name is generic, so people will worried because we havealign
andalign64
Another issue with ALIGN
is there is system headers predefined ALIGN
macro and easy to be conflicted(such as FreeBSD, Haiku), remove
it will cleanup these workarounds
To resolve this issues, do the following works:
- util: Add align_size and align_uintptr and use it to replace ALIGN treewide when proper
- treewide: Use align64 instead of ALIGN for 64 bit value parameter
- treewide: Use align instead of ALIGN for 32 bit value parameter
- util: Remove unused ALIGN function/macros and related fixes treewide
Edited by Yonggang Luo