Browse Source

Fix rom_string<long> methods for platforms where sizeof(long) > sizeof(int)

master
Jessica James 3 years ago
parent
commit
6578fef47f
  1. 14
      src/include/Jupiter/Readable_String.h

14
src/include/Jupiter/Readable_String.h

@ -117,12 +117,22 @@ namespace Jupiter {
template<>
inline long from_string<long>(std::string_view in_string) {
return asInt(in_string);
if constexpr (sizeof(long) == sizeof(int)) {
return asInt(in_string);
}
else {
return static_cast<long>(asLongLong(in_string));
}
}
template<>
inline unsigned long from_string<unsigned long>(std::string_view in_string) {
return asUnsignedInt(in_string);
if constexpr (sizeof(long) == sizeof(int)) {
return asUnsignedInt(in_string);
}
else {
return static_cast<unsigned long>(asUnsignedLongLong(in_string));
}
}
template<>

Loading…
Cancel
Save