diff options
Diffstat (limited to 'memlayout.h')
-rw-r--r-- | memlayout.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/memlayout.h b/memlayout.h index cd4433d..6a62cd7 100644 --- a/memlayout.h +++ b/memlayout.h @@ -10,13 +10,13 @@ #ifndef __ASSEMBLER__ -static inline uint v2p(void *a) { return (uint) a - KERNBASE; } -static inline void *p2v(uint a) { return (void *) a + KERNBASE; } +static inline uint v2p(void *a) { return ((uint) (a)) - KERNBASE; } +static inline void *p2v(uint a) { return (void *) ((a) + KERNBASE); } #endif -#define V2P(a) ((uint) a - KERNBASE) -#define P2V(a) ((void *) a + KERNBASE) +#define V2P(a) (((uint) (a)) - KERNBASE) +#define P2V(a) (((void *) (a)) + KERNBASE) #define V2P_WO(x) ((x) - KERNBASE) // same as V2P, but without casts #define P2V_WO(x) ((x) + KERNBASE) // same as V2P, but without casts |