#endif
}
-static const std::pair<const char*, const char*> ignored_local_variables[] = {
- std::pair<const char*, const char*>{ "e", "*" },
- std::pair<const char*, const char*>{ "_log_ev", "*" },
+static constexpr auto ignored_local_variables = {
+ std::make_pair("e", "*"),
+ std::make_pair("_log_ev", "*"),
- /* Ignore local variable about time used for tracing */
- std::pair<const char*, const char*>{ "start_time", "*" },
+ /* Ignore local variable about time used for tracing */
+ std::make_pair("start_time", "*"),
};
void ModelChecker::setup_ignore()
{
const RemoteSimulation& process = this->get_remote_simulation();
- for (std::pair<const char*, const char*> const& var :
- ignored_local_variables)
+ for (auto const& var : ignored_local_variables)
process.ignore_local_variable(var.first, var.second);
/* Static variable used for tracing */
#include "src/mc/mc_private.hpp"
#include "src/mc/remote/RemoteSimulation.hpp"
+#include <algorithm>
+#include <array>
#include <cinttypes>
#include <cstdint>
#include <cstdlib>
return std::vector<char>();
}
-static char hexdigits[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
-
/** Binary data to hexadecimal */
static inline std::array<char, 2> to_hex(std::uint8_t byte)
{
+ constexpr std::array<char, 16> hexdigits{
+ {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}};
// Horrid double braces!
// Apparently, this is needed in C++11 (not in C++14).
return {{hexdigits[byte >> 4], hexdigits[byte & 0xF]}};
{
std::string res;
res.resize(2 * count);
- for (std::size_t i = 0; i < count; i++) {
- std::array<char, 2> hex_byte = to_hex(data[i]);
- for (int j = 0; j < 2; ++j)
- res[2 * i + j] = hex_byte[j];
- }
+ for (std::size_t i = 0; i < count; i++)
+ std::copy_n(cbegin(to_hex(data[i])), 2, &res[2 * i]);
return res;
}