[rtems-libbsd commit] Add _ALIGN macro based on one in libmisc/shell/fts.c

Joel Sherrill joel at rtems.org
Wed Apr 4 22:56:38 UTC 2012


Module:    rtems-libbsd
Branch:    master
Commit:    772d929a3ca02ed113176afb757358a99cb490f1
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=772d929a3ca02ed113176afb757358a99cb490f1

Author:    Joel Sherrill <joel.sherrill at oarcorp.com>
Date:      Wed Apr  4 17:47:18 2012 -0500

Add _ALIGN macro based on one in libmisc/shell/fts.c

---

 freebsd/sys/param.h |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/freebsd/sys/param.h b/freebsd/sys/param.h
index 1a67648..cd00ea4 100644
--- a/freebsd/sys/param.h
+++ b/freebsd/sys/param.h
@@ -156,6 +156,18 @@
 #define	MJUM16BYTES	(16 * 1024)	/* jumbo cluster 16k */
 
 /*
+ * Round p (pointer or byte index) up to a correctly-aligned value
+ * for all data types (int, long, ...).   The result is u_long and
+ * must be cast to any desired pointer type.
+ */
+#ifndef _ALIGNBYTES
+#define _ALIGNBYTES     (sizeof(long) - 1)
+#endif
+#ifndef _ALIGN
+#define _ALIGN(p)       (((uintptr_t)(p) + _ALIGNBYTES) &~ _ALIGNBYTES)
+#endif
+
+/*
  * Some macros for units conversion
  */
 




More information about the vc mailing list