From 7388217c07ccbd387d3bcfbde76cca744c4fd6fe Mon Sep 17 00:00:00 2001 From: Ferran Balaguer Date: Mon, 2 Sep 2019 16:39:42 +0100 Subject: IVGCVSW-3693 Implement SendCounterPacket.SendPeriodicCounterSelectionPacket() function Signed-off-by: Ferran Balaguer Change-Id: Ib034a4f5ca589759d925e3dd0ca50e5a3dfa74c5 --- src/profiling/ProfilingUtils.cpp | 58 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/profiling/ProfilingUtils.cpp (limited to 'src/profiling/ProfilingUtils.cpp') diff --git a/src/profiling/ProfilingUtils.cpp b/src/profiling/ProfilingUtils.cpp new file mode 100644 index 0000000000..4dec7be6f2 --- /dev/null +++ b/src/profiling/ProfilingUtils.cpp @@ -0,0 +1,58 @@ +// +// Copyright © 2017 Arm Ltd. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#include "ProfilingUtils.hpp" + +#include + +namespace armnn +{ + +namespace profiling +{ + +void WriteUint32(unsigned char* buffer, unsigned int offset, uint32_t value) +{ + BOOST_ASSERT(buffer); + + buffer[offset] = static_cast(value & 0xFF); + buffer[offset + 1] = static_cast((value >> 8) & 0xFF); + buffer[offset + 2] = static_cast((value >> 16) & 0xFF); + buffer[offset + 3] = static_cast((value >> 24) & 0xFF); +} + +void WriteUint16(unsigned char* buffer, unsigned int offset, uint16_t value) +{ + BOOST_ASSERT(buffer != nullptr); + + buffer[offset] = static_cast(value & 0xFF); + buffer[offset + 1] = static_cast((value >> 8) & 0xFF); +} + +uint32_t ReadUint32(const unsigned char* buffer, unsigned int offset) +{ + BOOST_ASSERT(buffer); + + uint32_t value = 0; + value = static_cast(buffer[offset]); + value |= static_cast(buffer[offset + 1]) << 8; + value |= static_cast(buffer[offset + 2]) << 16; + value |= static_cast(buffer[offset + 3]) << 24; + return value; +} + +uint16_t ReadUint16(const unsigned char* buffer, unsigned int offset) +{ + BOOST_ASSERT(buffer); + + uint32_t value = 0; + value = static_cast(buffer[offset]); + value |= static_cast(buffer[offset + 1]) << 8; + return static_cast(value); +} + +} // namespace profiling + +} // namespace armnn \ No newline at end of file -- cgit v1.2.1