Skip to content

Commit

Permalink
Define is_aligned() only for the kernel
Browse files Browse the repository at this point in the history
is_aligned() is an already used symbol by OpenJDK 8.

Also, define is_aligned() as __is_aligned() that sys/cdefs.h defines for
userspace.

[1] https://github.com/openjdk/jdk/blob/jdk8-b05/hotspot/src/share/vm/memory/barrierSet.hpp#L182
  • Loading branch information
kwitaszczyk committed Jan 29, 2024
1 parent 874ceaf commit 35b9023
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sys/sys/param.h
Original file line number Diff line number Diff line change
Expand Up @@ -350,12 +350,14 @@
#define howmany(x, y) (((x)+((y)-1))/(y))
#endif
#define nitems(x) (sizeof((x)) / sizeof((x)[0]))
#define is_aligned(x, y) __builtin_is_aligned(x, y)
#define rounddown(x, y) (((x)/(y))*(y))
#define rounddown2(x, y) __align_down(x, y) /* if y is power of two */
#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) /* to any y */
#define roundup2(x, y) __align_up(x, y) /* if y is powers of two */
#define powerof2(x) ((((x)-1)&(x))==0)
#ifdef _KERNEL
#define is_aligned(x, y) __is_aligned(x, y)
#endif

/* Macros for min/max. */
#define MIN(a,b) (((a)<(b))?(a):(b))
Expand Down

0 comments on commit 35b9023

Please sign in to comment.