Module Name: src
Committed By: christos
Date: Sun Oct 21 22:35:52 UTC 2012
Modified Files:
src/sys/sys: cdefs.h
Log Message:
Add an __alignof() macro.
To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/sys/cdefs.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/sys/cdefs.h
diff -u src/sys/sys/cdefs.h:1.100 src/sys/sys/cdefs.h:1.101
--- src/sys/sys/cdefs.h:1.100 Fri Aug 24 01:47:51 2012
+++ src/sys/sys/cdefs.h Sun Oct 21 18:35:52 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: cdefs.h,v 1.100 2012/08/24 05:47:51 dholland Exp $ */
+/* $NetBSD: cdefs.h,v 1.101 2012/10/21 22:35:52 christos Exp $ */
/*
* Copyright (c) 1991, 1993
@@ -498,6 +498,11 @@
#define __link_set_entry(set, idx) (__link_set_start(set)[idx])
/*
+ * Return the natural alignment in bytes for the given type
+ */
+#define __alignof(__t) (sizeof(struct { char __x; __t __y; }) - sizeof(__t))
+
+/*
* Return the number of elements in a statically-allocated array,
* __x.
*/