Remove ARDUINOJSON_HAS_LONG_LONG (#1820)

This commit is contained in:
Benoit Blanchon
2023-02-10 08:45:29 +01:00
parent f699954f4d
commit 3bdedc9a2f
8 changed files with 6 additions and 27 deletions

View File

@ -9,10 +9,6 @@
# error This test requires sizeof(long) < 8
#endif
#if !ARDUINOJSON_HAS_LONG_LONG
# error This test requires C++11
#endif
int main() {
DynamicJsonDocument doc(1024);
doc["dummy"] = static_cast<long long>(42);

View File

@ -99,7 +99,6 @@ TEST_CASE("canConvertNumber<TOut, TIn>()") {
CHECK(canConvertNumber<uint32_t, float>(4.294967296e+9f) == false);
}
#if ARDUINOJSON_HAS_LONG_LONG
SECTION("float -> int64_t") {
CHECK(canConvertNumber<int64_t, float>(0) == true);
CHECK(canConvertNumber<int64_t, float>(-9.22337204e+18f) == true);
@ -129,5 +128,4 @@ TEST_CASE("canConvertNumber<TOut, TIn>()") {
CHECK(canConvertNumber<uint64_t, double>(1.844674407370955166e+19) ==
false);
}
#endif
}

View File

@ -5,10 +5,8 @@
#pragma once
#if __cplusplus >= 201103L
# define ARDUINOJSON_HAS_LONG_LONG 1
# define ARDUINOJSON_HAS_RVALUE_REFERENCES 1
#else
# define ARDUINOJSON_HAS_LONG_LONG 0
# define ARDUINOJSON_HAS_RVALUE_REFERENCES 0
#endif
@ -77,8 +75,7 @@
// Store integral values with long (0) or long long (1)
#ifndef ARDUINOJSON_USE_LONG_LONG
# if ARDUINOJSON_HAS_LONG_LONG && defined(__SIZEOF_POINTER__) && \
__SIZEOF_POINTER__ >= 4 || \
# if defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ >= 4 || \
defined(_MSC_VER)
# define ARDUINOJSON_USE_LONG_LONG 1
# endif

View File

@ -21,12 +21,8 @@ typedef unsigned long JsonUInt;
} // namespace ARDUINOJSON_NAMESPACE
#if ARDUINOJSON_HAS_LONG_LONG && !ARDUINOJSON_USE_LONG_LONG
# define ARDUINOJSON_ASSERT_INTEGER_TYPE_IS_SUPPORTED(T) \
static_assert(sizeof(T) <= sizeof(ARDUINOJSON_NAMESPACE::JsonInteger), \
"To use 64-bit integers with ArduinoJson, you must set " \
"ARDUINOJSON_USE_LONG_LONG to 1. See " \
"https://arduinojson.org/v6/api/config/use_long_long/");
#else
# define ARDUINOJSON_ASSERT_INTEGER_TYPE_IS_SUPPORTED(T)
#endif
#define ARDUINOJSON_ASSERT_INTEGER_TYPE_IS_SUPPORTED(T) \
static_assert(sizeof(T) <= sizeof(ARDUINOJSON_NAMESPACE::JsonInteger), \
"To use 64-bit integers with ArduinoJson, you must set " \
"ARDUINOJSON_USE_LONG_LONG to 1. See " \
"https://arduinojson.org/v6/api/config/use_long_long/");

View File

@ -23,10 +23,8 @@ struct is_integral : integral_constant<bool,
is_same<typename remove_cv<T>::type, unsigned int>::value ||
is_same<typename remove_cv<T>::type, signed long>::value ||
is_same<typename remove_cv<T>::type, unsigned long>::value ||
#if ARDUINOJSON_HAS_LONG_LONG
is_same<typename remove_cv<T>::type, signed long long>::value ||
is_same<typename remove_cv<T>::type, unsigned long long>::value ||
#endif
is_same<typename remove_cv<T>::type, char>::value ||
is_same<typename remove_cv<T>::type, bool>::value> {};
// clang-format on

View File

@ -18,9 +18,7 @@ struct is_signed : integral_constant<bool,
is_same<typename remove_cv<T>::type, signed short>::value ||
is_same<typename remove_cv<T>::type, signed int>::value ||
is_same<typename remove_cv<T>::type, signed long>::value ||
#if ARDUINOJSON_HAS_LONG_LONG
is_same<typename remove_cv<T>::type, signed long long>::value ||
#endif
is_same<typename remove_cv<T>::type, float>::value ||
is_same<typename remove_cv<T>::type, double>::value> {};
// clang-format on

View File

@ -17,9 +17,7 @@ struct is_unsigned : integral_constant<bool,
is_same<typename remove_cv<T>::type, unsigned short>::value ||
is_same<typename remove_cv<T>::type, unsigned int>::value ||
is_same<typename remove_cv<T>::type, unsigned long>::value ||
#if ARDUINOJSON_HAS_LONG_LONG
is_same<typename remove_cv<T>::type, unsigned long long>::value ||
#endif
is_same<typename remove_cv<T>::type, bool>::value> {};
// clang-format on
} // namespace ARDUINOJSON_NAMESPACE

View File

@ -33,10 +33,8 @@ struct make_unsigned<signed long> : type_identity<unsigned long> {};
template <>
struct make_unsigned<unsigned long> : type_identity<unsigned long> {};
#if ARDUINOJSON_HAS_LONG_LONG
template <>
struct make_unsigned<signed long long> : type_identity<unsigned long long> {};
template <>
struct make_unsigned<unsigned long long> : type_identity<unsigned long long> {};
#endif
} // namespace ARDUINOJSON_NAMESPACE