Implement _ALIGN() using internal integer types.

The existing version depends on register_t and uintptr_t, which are only
available when including headers such as <sys/types.h>. As this macro is
used by <sys/socket.h>, for example, it should be written in such a way
that it doesn't depend on those types.
This commit is contained in:
Ed Schouten 2016-05-31 13:31:19 +00:00
parent b240f5e262
commit 3a45c3d643
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=301037

View File

@ -46,7 +46,7 @@
* for all data types (int, long, ...). The result is unsigned int
* and must be cast to any desired pointer type.
*/
#define _ALIGNBYTES (sizeof(register_t) - 1)
#define _ALIGN(p) (((uintptr_t)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
#define _ALIGNBYTES (sizeof(__register_t) - 1)
#define _ALIGN(p) (((__uintptr_t)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
#endif /* !_X86_INCLUDE__ALIGN_H_ */