mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2025-12-19 07:18:10 +08:00
Merge pull request #404 from farrrb/fix-nibbles-UnityPrintNumberHex
Fixed maximum number of nibbles for processor where sizeof() operator…
This commit is contained in:
@@ -352,9 +352,9 @@ void UnityPrintNumberHex(const UNITY_UINT number, const char nibbles_to_print)
|
|||||||
int nibble;
|
int nibble;
|
||||||
char nibbles = nibbles_to_print;
|
char nibbles = nibbles_to_print;
|
||||||
|
|
||||||
if ((unsigned)nibbles > (2 * sizeof(number)))
|
if ((unsigned)nibbles > UNITY_MAX_NIBBLES)
|
||||||
{
|
{
|
||||||
nibbles = 2 * sizeof(number);
|
nibbles = UNITY_MAX_NIBBLES;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (nibbles > 0)
|
while (nibbles > 0)
|
||||||
|
|||||||
@@ -122,18 +122,20 @@
|
|||||||
* 64-bit Support
|
* 64-bit Support
|
||||||
*-------------------------------------------------------*/
|
*-------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Auto-detect 64 Bit Support */
|
||||||
#ifndef UNITY_SUPPORT_64
|
#ifndef UNITY_SUPPORT_64
|
||||||
#if UNITY_LONG_WIDTH == 64 || UNITY_POINTER_WIDTH == 64
|
#if UNITY_LONG_WIDTH == 64 || UNITY_POINTER_WIDTH == 64
|
||||||
#define UNITY_SUPPORT_64
|
#define UNITY_SUPPORT_64
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* 64-Bit Support Dependent Configuration */
|
||||||
#ifndef UNITY_SUPPORT_64
|
#ifndef UNITY_SUPPORT_64
|
||||||
/* No 64-bit Support */
|
/* No 64-bit Support */
|
||||||
typedef UNITY_UINT32 UNITY_UINT;
|
typedef UNITY_UINT32 UNITY_UINT;
|
||||||
typedef UNITY_INT32 UNITY_INT;
|
typedef UNITY_INT32 UNITY_INT;
|
||||||
|
#define UNITY_MAX_NIBBLES (8) /* Maximum number of nibbles in a UNITY_(U)INT */
|
||||||
#else
|
#else
|
||||||
|
|
||||||
/* 64-bit Support */
|
/* 64-bit Support */
|
||||||
#if (UNITY_LONG_WIDTH == 32)
|
#if (UNITY_LONG_WIDTH == 32)
|
||||||
typedef unsigned long long UNITY_UINT64;
|
typedef unsigned long long UNITY_UINT64;
|
||||||
@@ -146,7 +148,7 @@
|
|||||||
#endif
|
#endif
|
||||||
typedef UNITY_UINT64 UNITY_UINT;
|
typedef UNITY_UINT64 UNITY_UINT;
|
||||||
typedef UNITY_INT64 UNITY_INT;
|
typedef UNITY_INT64 UNITY_INT;
|
||||||
|
#define UNITY_MAX_NIBBLES (16) /* Maximum number of nibbles in a UNITY_(U)INT */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*-------------------------------------------------------
|
/*-------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user