Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
289cd3cc
Commit
289cd3cc
authored
Feb 08, 2016
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Shift more general stuff from common.h to vdef.h
parent
a3c3181c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
29 deletions
+27
-29
common.h
bin/varnishd/common/common.h
+0
-29
vdef.h
include/vdef.h
+27
-0
No files found.
bin/varnishd/common/common.h
View file @
289cd3cc
...
...
@@ -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))
include/vdef.h
View file @
289cd3cc
...
...
@@ -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
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment