Commit 289cd3cc authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Shift more general stuff from common.h to vdef.h

parent a3c3181c
......@@ -40,8 +40,6 @@
#include "vsb.h"
#include "vapi/vsc_int.h"
struct cli;
/**********************************************************************/
/* Name of transient storage */
......@@ -78,30 +76,3 @@ void VSM_common_delete(struct vsm_sc **sc);
void VSM_common_copy(struct vsm_sc *to, const struct vsm_sc *from);
void VSM_common_cleaner(struct vsm_sc *sc, struct VSC_C_main *stats);
void VSM_common_ageupdate(const struct vsm_sc *sc);
/*---------------------------------------------------------------------
* Generic power-2 rounding macros
*/
#define PWR2(x) ((((x)-1UL)&(x))==0) /* Is a power of two */
#define RDN2(x, y) ((x)&(~((uintptr_t)(y)-1UL))) /* PWR2(y) true */
#define RUP2(x, y) (((x)+((y)-1))&(~((uintptr_t)(y)-1UL))) /* PWR2(y) true */
/*--------------------------------------------------------------------
* Pointer alignment magic
*/
#if defined(__sparc__)
/* NB: Overbroad test for 32bit userland on 64bit SPARC cpus. */
# define PALGN (sizeof(double) - 1) /* size of alignment */
#else
# define PALGN (sizeof(void *) - 1) /* size of alignment */
#endif
#define PAOK(p) (((uintptr_t)(p) & PALGN) == 0) /* is aligned */
#define PRNDDN(p) ((uintptr_t)(p) & ~PALGN) /* Round down */
#define PRNDUP(p) (((uintptr_t)(p) + PALGN) & ~PALGN) /* Round up */
/*--------------------------------------------------------------------
* To be used as little as possible to wash off const/volatile etc.
*/
#define TRUST_ME(ptr) ((void*)(uintptr_t)(ptr))
......@@ -67,6 +67,33 @@
# define __v_printflike(f,a)
#endif
/*********************************************************************
* Pointer alignment magic
*/
#if defined(__sparc__)
/* NB: Overbroad test for 32bit userland on 64bit SPARC cpus. */
# define PALGN (sizeof(double) - 1) /* size of alignment */
#else
# define PALGN (sizeof(void *) - 1) /* size of alignment */
#endif
#define PAOK(p) (((uintptr_t)(p) & PALGN) == 0) /* is aligned */
#define PRNDDN(p) ((uintptr_t)(p) & ~PALGN) /* Round down */
#define PRNDUP(p) (((uintptr_t)(p) + PALGN) & ~PALGN) /* Round up */
/*********************************************************************
* To be used as little as possible to wash off const/volatile etc.
*/
#define TRUST_ME(ptr) ((void*)(uintptr_t)(ptr))
/**********************************************************************
* Generic power-2 rounding macros
*/
#define PWR2(x) ((((x)-1UL)&(x))==0) /* Is a power of two */
#define RDN2(x, y) ((x)&(~((uintptr_t)(y)-1UL))) /* PWR2(y) true */
#define RUP2(x, y) (((x)+((y)-1))&(~((uintptr_t)(y)-1UL))) /* PWR2(y) true */
/**********************************************************************
* FlexeLint and compiler shutuppery
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment