Permalink
Browse files

Merge branch 'egil/ei-fix-buffer-alignment/OTP-9390' into dev

* egil/ei-fix-buffer-alignment/OTP-9390:
  Align ei buffer according to size of pointers
  • Loading branch information...
2 parents b467765 + f24cff9 commit 7092c4a41ac0d38ae457c2dc768aa542337d8b8c @psyeugenic psyeugenic committed Jun 30, 2011
Showing with 6 additions and 1 deletion.
  1. +6 −1 lib/erl_interface/src/connect/ei_resolve.c
@@ -185,7 +185,12 @@ static int verify_dns_configuration(void)
* align: increment buf until it is dword-aligned, reduce len by same amount.
* advance: increment buf by n bytes, reduce len by same amount .
*/
-#define align_buf(buf,len) for (;(((unsigned)buf)&0x3); (buf)++, len--)
+#if defined SIZEOF_VOID_P
+#define ALIGNBYTES (SIZEOF_VOID_P - 1)
+#else
+#define ALIGNBYTES (sizeof(void*) - 1)
+#endif
+#define align_buf(buf,len) for (;(((unsigned)buf) & ALIGNBYTES); (buf)++, len--)
#define advance_buf(buf,len,n) ((buf)+=(n),(len)-=(n))
/* "and now the tricky part..." */

0 comments on commit 7092c4a

Please sign in to comment.