summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorVasil Dimov <vasil.dimov@oracle.com>2010-05-27 12:47:57 +0300
committerVasil Dimov <vasil.dimov@oracle.com>2010-05-27 12:47:57 +0300
commita8e06452fc1166492dffbe379fbb3572f4f223d8 (patch)
tree2589cf05b7b91380340406f180c301c410386242 /include
parenta0f33cc460046d74a6789134ef43bcb03988ba92 (diff)
parentbac571e136a0bfe448576128870fb888587f86d1 (diff)
downloadmariadb-git-a8e06452fc1166492dffbe379fbb3572f4f223d8.tar.gz
Merge mysql-trunk-bugfixing -> mysql-trunk-innodb
(skipping the change to storage/innobase/os/os0file.c because that issue has already been addressed in mysql-trunk-innodb)
Diffstat (limited to 'include')
-rw-r--r--include/my_global.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/my_global.h b/include/my_global.h
index 094853cb642..2a65c610604 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -1070,6 +1070,17 @@ typedef long long my_ptrdiff_t;
#define MY_DIV_UP(A, B) (((A) + (B) - 1) / (B))
#define MY_ALIGNED_BYTE_ARRAY(N, S, T) T N[MY_DIV_UP(S, sizeof(T))]
+#ifdef __cplusplus
+template <size_t sz> struct Aligned_char_array
+{
+ union {
+ void *v; // Ensures alignment.
+ char arr[sz]; // The actual buffer.
+ } u;
+ void* arr() { return &u.arr[0]; }
+};
+#endif /* __cplusplus */
+
/*
Custom version of standard offsetof() macro which can be used to get
offsets of members in class for non-POD types (according to the current