r4657 - trunk/varnish-cache/bin/varnishd
phk at varnish-cache.org
phk at varnish-cache.org
Tue Apr 13 23:05:12 CEST 2010
Author: phk
Date: 2010-04-13 23:05:11 +0200 (Tue, 13 Apr 2010)
New Revision: 4657
Modified:
trunk/varnish-cache/bin/varnishd/cache.h
Log:
Add some semi-magic functions to align pointers with.
Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h 2010-04-13 09:06:37 UTC (rev 4656)
+++ trunk/varnish-cache/bin/varnishd/cache.h 2010-04-13 21:05:11 UTC (rev 4657)
@@ -95,6 +95,15 @@
#define DIGEST_LEN 32
+/*--------------------------------------------------------------------
+ * Pointer aligment magic
+ */
+
+#define PALGN (sizeof(void *) - 1)
+#define PAOK(p) (((uintptr_t)(p) & PALGN) == 0)
+#define PRNDDN(p) ((uintptr_t)(p) & ~PALGN)
+#define PRNDUP(p) (((uintptr_t)(p) + PALGN) & ~PALGN)
+
/*--------------------------------------------------------------------*/
typedef struct {
More information about the varnish-commit
mailing list