forked from bblanchon/ArduinoJson
Add ARDUINOJSON_SIZEOF_POINTER
This commit is contained in:
@ -59,15 +59,24 @@
|
|||||||
# define ARDUINOJSON_USE_DOUBLE 1
|
# define ARDUINOJSON_USE_DOUBLE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Store integral values with long (0) or long long (1)
|
// Pointer size: a heuristic to set sensible defaults
|
||||||
#ifndef ARDUINOJSON_USE_LONG_LONG
|
#ifndef ARDUINOJSON_SIZEOF_POINTER
|
||||||
# if defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ >= 4 || \
|
# if defined(__SIZEOF_POINTER__)
|
||||||
defined(_MSC_VER)
|
# define ARDUINOJSON_SIZEOF_POINTER __SIZEOF_POINTER__
|
||||||
# define ARDUINOJSON_USE_LONG_LONG 1
|
# elif defined(_WIN64) && _WIN64
|
||||||
|
# define ARDUINOJSON_SIZEOF_POINTER 8 // 64 bits
|
||||||
|
# else
|
||||||
|
# define ARDUINOJSON_SIZEOF_POINTER 4 // assume 32 bits otherwise
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Store integral values with long (0) or long long (1)
|
||||||
#ifndef ARDUINOJSON_USE_LONG_LONG
|
#ifndef ARDUINOJSON_USE_LONG_LONG
|
||||||
# define ARDUINOJSON_USE_LONG_LONG 0
|
# if ARDUINOJSON_SIZEOF_POINTER >= 4 // 32 & 64 bits systems
|
||||||
|
# define ARDUINOJSON_USE_LONG_LONG 1
|
||||||
|
# else
|
||||||
|
# define ARDUINOJSON_USE_LONG_LONG 0
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Limit nesting as the stack is likely to be small
|
// Limit nesting as the stack is likely to be small
|
||||||
@ -75,33 +84,25 @@
|
|||||||
# define ARDUINOJSON_DEFAULT_NESTING_LIMIT 10
|
# define ARDUINOJSON_DEFAULT_NESTING_LIMIT 10
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Number of bits to store the variant identifier
|
// Number of bytes to store the variant identifier
|
||||||
#ifndef ARDUINOJSON_SLOT_ID_SIZE
|
#ifndef ARDUINOJSON_SLOT_ID_SIZE
|
||||||
# if defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ <= 2
|
# if ARDUINOJSON_SIZEOF_POINTER <= 2
|
||||||
// Address space == 16-bit => max 127 values
|
# define ARDUINOJSON_SLOT_ID_SIZE 1 // up to 255 slots
|
||||||
# define ARDUINOJSON_SLOT_ID_SIZE 1
|
# elif ARDUINOJSON_SIZEOF_POINTER == 4
|
||||||
# elif defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ >= 8 || \
|
# define ARDUINOJSON_SLOT_ID_SIZE 2 // up to 65535 slots
|
||||||
defined(_WIN64) && _WIN64
|
|
||||||
// Address space == 64-bit => max 2147483647 values
|
|
||||||
# define ARDUINOJSON_SLOT_ID_SIZE 4
|
|
||||||
# else
|
# else
|
||||||
// Address space == 32-bit => max 32767 values
|
# define ARDUINOJSON_SLOT_ID_SIZE 4 // up to 4294967295 slots
|
||||||
# define ARDUINOJSON_SLOT_ID_SIZE 2
|
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Capacity of each variant pool (in slots)
|
// Capacity of each variant pool (in slots)
|
||||||
#ifndef ARDUINOJSON_POOL_CAPACITY
|
#ifndef ARDUINOJSON_POOL_CAPACITY
|
||||||
# if defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ <= 2
|
# if ARDUINOJSON_SIZEOF_POINTER <= 2
|
||||||
// Address space == 16-bit
|
|
||||||
# define ARDUINOJSON_POOL_CAPACITY 16 // 128 bytes
|
# define ARDUINOJSON_POOL_CAPACITY 16 // 128 bytes
|
||||||
# elif defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ >= 8 || \
|
# elif ARDUINOJSON_SIZEOF_POINTER == 4
|
||||||
defined(_WIN64) && _WIN64
|
|
||||||
// Address space == 64-bit
|
|
||||||
# define ARDUINOJSON_POOL_CAPACITY 128 // 3072 bytes
|
|
||||||
# else
|
|
||||||
// Address space == 32-bit
|
|
||||||
# define ARDUINOJSON_POOL_CAPACITY 64 // 1024 bytes
|
# define ARDUINOJSON_POOL_CAPACITY 64 // 1024 bytes
|
||||||
|
# else
|
||||||
|
# define ARDUINOJSON_POOL_CAPACITY 128 // 3072 bytes
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -114,7 +115,7 @@
|
|||||||
// Disabled by default on 8-bit platforms because it's not worth the increase in
|
// Disabled by default on 8-bit platforms because it's not worth the increase in
|
||||||
// code size
|
// code size
|
||||||
#ifndef ARDUINOJSON_AUTO_SHRINK
|
#ifndef ARDUINOJSON_AUTO_SHRINK
|
||||||
# if defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ <= 2
|
# if ARDUINOJSON_SIZEOF_POINTER <= 2
|
||||||
# define ARDUINOJSON_AUTO_SHRINK 0
|
# define ARDUINOJSON_AUTO_SHRINK 0
|
||||||
# else
|
# else
|
||||||
# define ARDUINOJSON_AUTO_SHRINK 1
|
# define ARDUINOJSON_AUTO_SHRINK 1
|
||||||
|
Reference in New Issue
Block a user