Skip to content

Commit

Permalink
MessageSet: fixed comments from new enum encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasDebrunner committed Mar 14, 2024
1 parent 820c6e6 commit a6d7af9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions include/mav/MessageSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#include <utility>
#include <memory>
#include <optional>
#include <bitset>
#include <cmath>

#include "MessageDefinition.h"
Expand Down Expand Up @@ -104,12 +103,12 @@ namespace mav {
static uint64_t _parseEnumValue(const std::string &str) {
// Check for binary format: 0b or 0B
if (str.size() >= 2 && (str.substr(0, 2) == "0b" || str.substr(0, 2) == "0B")) {
return std::bitset<64>(str.substr(2)).to_ullong();
return _strict_stoul(str.substr(2), 2);
}

// Check for hexadecimal format: 0x or 0X
if (str.size() >= 2 && (str.substr(0, 2) == "0x" || str.substr(0, 2) == "0X")) {
return _strict_stoul(str, 16);
return _strict_stoul(str.substr(2), 16);
}

// Check for exponential format: 2**
Expand Down

0 comments on commit a6d7af9

Please sign in to comment.