Matthew Bentham | 4057d91 | 2019-01-21 15:45:51 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "PrototxtConversions.hpp" |
| 7 | |
| 8 | #include <boost/format.hpp> |
| 9 | |
| 10 | #include <iomanip> |
| 11 | #include <sstream> |
| 12 | #include <string> |
| 13 | |
| 14 | namespace armnnUtils |
| 15 | { |
| 16 | |
| 17 | /// Converts an int value into the Prototxt octal representation |
| 18 | std::string ConvertInt32ToOctalString(int value) |
| 19 | { |
| 20 | std::stringstream ss; |
| 21 | std::string returnString; |
| 22 | for (int i = 0; i < 4; ++i) |
| 23 | { |
| 24 | ss << "\\"; |
| 25 | ss << std::setw(3) << std::setfill('0') << std::oct << ((value >> (i * 8)) & 0xFF); |
| 26 | } |
| 27 | |
| 28 | ss >> returnString; |
| 29 | return returnString; |
| 30 | } |
| 31 | |
| 32 | } // namespace armnnUtils |