commit | 59e85cd3c415ca483318bd7e4d5e743253b64685 | [log] [tgz] |
---|---|---|
author | Carl Shapiro <cshapiro@google.com> | Tue Jun 21 10:16:23 2011 -0700 |
committer | Carl Shapiro <cshapiro@google.com> | Tue Jun 21 10:39:12 2011 -0700 |
tree | c3584fd5e11fbde77c0b92c86497829f51eed022 | |
parent | 806defae80d39945272e1cd919b1c22572152117 [diff] |
Add implementations of sizeof and offsetof for class types. Change-Id: I014205daafa6201f5d1d7d206e34632384a25f79
diff --git a/src/macros.h b/src/macros.h index 39cecf2..95c2590 100644 --- a/src/macros.h +++ b/src/macros.h
@@ -30,4 +30,11 @@ TypeName(); \ DISALLOW_COPY_AND_ASSIGN(TypeName) +#define SIZEOF_MEMBER(t, f) sizeof(((t*) 4096)->f) + +#define OFFSETOF_MEMBER(t, f) \ + (reinterpret_cast<char*>( \ + &reinterpret_cast<t*>(16)->f) - \ + reinterpret_cast<char*>(16)) + #endif // ART_MACROS_H_