From 3ef64ee047f4b5ab6c179d75a0c0124b8f1ce2e4 Mon Sep 17 00:00:00 2001 From: mvandervoord Date: Fri, 4 Mar 2011 19:01:27 +0000 Subject: [PATCH] - replacing non-universal method of masking word sizes git-svn-id: http://unity.svn.sourceforge.net/svnroot/unity/trunk@123 e7d17a6e-8845-0410-bbbc-c8efb4fdad7e --- src/unity.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/unity.c b/src/unity.c index b3d4ea5..9fb2fb1 100644 --- a/src/unity.c +++ b/src/unity.c @@ -28,6 +28,20 @@ const char* UnityStrPointless= " You Asked Me To Compare Nothing, Which Was Poin const char* UnityStrNullPointerForExpected= " Expected pointer to be NULL"; const char* UnityStrNullPointerForActual = " Actual pointer was NULL"; +const _U_UINT UnitySizeMask[] = +{ + 255, + 65535, + 65535, + 4294967295, + 4294967295, + 4294967295, + 4294967295 +#ifdef UNITY_SUPPORT_64 + ,0xFFFFFFFFFFFFFFFF +#endif +}; + //----------------------------------------------- // Pretty Printers & Test Result Output Handlers //----------------------------------------------- @@ -77,13 +91,12 @@ void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T s } else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT) { - UnityPrintNumberUnsigned((_U_UINT)number & ((_U_UINT)1 << ((((int)style & 0x000F) << 3) - 1))); + UnityPrintNumberUnsigned( (_U_UINT)number & UnitySizeMask[((_U_UINT)style & (_U_UINT)0x0F) - 1] ); } else { UnityPrintNumberHex((_U_UINT)number, (style & 0x000F) << 1); } - } //----------------------------------------------- -- GitLab