From 767adc92c8cec7fd27649bf98d5bd5d1275670cf Mon Sep 17 00:00:00 2001 From: Chris Manton Date: Mon, 8 Mar 2021 10:05:41 -0800 Subject: [PATCH] Template prep for bta hardening Syntactic sugar to wrangle next Union battle Towards readable code Bug: 163134718 Test: cert Tag: #refactor Change-Id: I5921b2ab188f1062b0c1ad19bf9e2d0e2c8017db --- bta/sys/bta_sys.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bta/sys/bta_sys.h b/bta/sys/bta_sys.h index b2926963c..407a51efd 100644 --- a/bta/sys/bta_sys.h +++ b/bta/sys/bta_sys.h @@ -45,6 +45,11 @@ typedef bool(tBTA_SYS_EVT_HDLR)(BT_HDR* p_msg); /* disable function type */ typedef void(tBTA_SYS_DISABLE)(void); +template +inline const T* Specialize(U* u) { + return const_cast(reinterpret_cast(u)); +} + #ifndef BTA_DM_NUM_JV_ID #define BTA_DM_NUM_JV_ID 2 #endif -- 2.11.0