summaryrefslogtreecommitdiff
path: root/libs/binder/Utils.h
diff options
context:
space:
mode:
author Tomasz Wasilczyk <twasilczyk@google.com> 2023-11-02 15:07:45 -0700
committer Tomasz Wasilczyk <twasilczyk@google.com> 2023-11-03 09:40:33 -0700
commitdf07f945b946fd1f7039d225ecd3de51a901ace7 (patch)
tree1f37c190b6cd567549cfd14f3efca5eeb18c19a7 /libs/binder/Utils.h
parentd429f318b42341f27d035072193c2d5da0826e93 (diff)
Binder: migrate off libbase macros
Test: mma Bug: 302723053 Change-Id: Ie7c13c324311f600d72bc8ecc4157ad6c46259a0
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);