[code-utils] rename alignment macros to use "OT_" prefix (#4351)

This commit is contained in:
Abtin Keshavarzian
2019-11-26 02:45:47 +08:00
committed by Jonathan Hui
parent f756953819
commit 9c6b33b5f2
8 changed files with 10 additions and 10 deletions
+1 -1
View File
@@ -45,7 +45,7 @@
namespace ot {
namespace Cli {
static otDEFINE_ALIGNED_VAR(sCliConsoleRaw, sizeof(Console), uint64_t);
static OT_DEFINE_ALIGNED_VAR(sCliConsoleRaw, sizeof(Console), uint64_t);
extern "C" void otCliConsoleInit(otInstance *aInstance, otCliConsoleOutputCallback aCallback, void *aContext)
{
+1 -1
View File
@@ -99,7 +99,7 @@ OT_STATIC_ASSERT(OPENTHREAD_CONFIG_CLI_MAX_LINE_LENGTH <= OPENTHREAD_CONFIG_CLI_
namespace ot {
namespace Cli {
static otDEFINE_ALIGNED_VAR(sCliUartRaw, sizeof(Uart), uint64_t);
static OT_DEFINE_ALIGNED_VAR(sCliUartRaw, sizeof(Uart), uint64_t);
extern "C" void otCliUartInit(otInstance *aInstance)
{
+1 -1
View File
@@ -598,7 +598,7 @@ private:
OT_STATIC_ASSERT(sizeof(mBuffer.mHead.mInfo) + sizeof(HelpData) + kHelpDataAlignment <= sizeof(mBuffer),
"Insufficient buffer size for CoAP processing!");
return *static_cast<const HelpData *>(otALIGN(mBuffer.mHead.mData, kHelpDataAlignment));
return *static_cast<const HelpData *>(OT_ALIGN(mBuffer.mHead.mData, kHelpDataAlignment));
}
HelpData &GetHelpData(void) { return const_cast<HelpData &>(static_cast<const Message *>(this)->GetHelpData()); }
+3 -3
View File
@@ -72,14 +72,14 @@
* @returns The aligned pointer.
*
*/
#define otALIGN(aPointer, aAlignment) \
#define OT_ALIGN(aPointer, aAlignment) \
((void *)(((uintptr_t)(aPointer) + (aAlignment)-1UL) & ~((uintptr_t)(aAlignment)-1UL)))
// Calculates the aligned variable size.
#define otALIGNED_VAR_SIZE(size, align_type) (((size) + (sizeof(align_type) - 1)) / sizeof(align_type))
#define OT_ALIGNED_VAR_SIZE(size, align_type) (((size) + (sizeof(align_type) - 1)) / sizeof(align_type))
// Allocate the structure using "raw" storage.
#define otDEFINE_ALIGNED_VAR(name, size, align_type) \
#define OT_DEFINE_ALIGNED_VAR(name, size, align_type) \
align_type name[(((size) + (sizeof(align_type) - 1)) / sizeof(align_type))]
/**
+1 -1
View File
@@ -62,7 +62,7 @@ public:
// `ExtensionBase` API
// ----------------------------------------------------------------------------
static otDEFINE_ALIGNED_VAR(sExtensionRaw, sizeof(Extension), uint64_t);
static OT_DEFINE_ALIGNED_VAR(sExtensionRaw, sizeof(Extension), uint64_t);
ExtensionBase &ExtensionBase::Init(Instance &aInstance)
{
+1 -1
View File
@@ -44,7 +44,7 @@ namespace ot {
#if !OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE
// Define the raw storage used for OpenThread instance (in single-instance case).
otDEFINE_ALIGNED_VAR(gInstanceRaw, sizeof(Instance), uint64_t);
OT_DEFINE_ALIGNED_VAR(gInstanceRaw, sizeof(Instance), uint64_t);
#endif
+1 -1
View File
@@ -60,7 +60,7 @@ namespace Ncp {
#if OPENTHREAD_ENABLE_NCP_VENDOR_HOOK == 0
static otDEFINE_ALIGNED_VAR(sNcpRaw, sizeof(NcpSpi), uint64_t);
static OT_DEFINE_ALIGNED_VAR(sNcpRaw, sizeof(NcpSpi), uint64_t);
extern "C" void otNcpInit(otInstance *aInstance)
{
+1 -1
View File
@@ -64,7 +64,7 @@ namespace Ncp {
#if OPENTHREAD_ENABLE_NCP_VENDOR_HOOK == 0
static otDEFINE_ALIGNED_VAR(sNcpRaw, sizeof(NcpUart), uint64_t);
static OT_DEFINE_ALIGNED_VAR(sNcpRaw, sizeof(NcpUart), uint64_t);
extern "C" void otNcpInit(otInstance *aInstance)
{