summaryrefslogtreecommitdiff
path: root/libs/binder/Utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'libs/binder/Utils.h')
-rw-r--r--libs/binder/Utils.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/libs/binder/Utils.h b/libs/binder/Utils.h
index 8942c31c48..68d639208e 100644
--- a/libs/binder/Utils.h
+++ b/libs/binder/Utils.h
@@ -45,6 +45,17 @@
namespace android {
+/**
+ * Get the size of a statically initialized array.
+ *
+ * \param N the array to get the size of.
+ * \return the size of the array.
+ */
+template <typename T, size_t N>
+constexpr size_t countof(T (&)[N]) {
+ return N;
+}
+
// avoid optimizations
void zeroMemory(uint8_t* data, size_t size);