From 71b4f95a0a25698918de25aa018d245afaf32e08 Mon Sep 17 00:00:00 2001 From: greg-williams Date: Mon, 31 Aug 2009 15:59:48 +0000 Subject: [PATCH] Cleaned up typedefs for micro integer width configuration. git-svn-id: http://unity.svn.sourceforge.net/svnroot/unity/trunk@42 e7d17a6e-8845-0410-bbbc-c8efb4fdad7e --- iar_msp430.yml | 2 +- src/unity.h | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/iar_msp430.yml b/iar_msp430.yml index 7ba4ac9..fd16bf2 100644 --- a/iar_msp430.yml +++ b/iar_msp430.yml @@ -21,7 +21,7 @@ compiler: - --no_tbaa - --debug - -D__MSP430F149__ - - -DBUS_WIDTH=16 + - -DINT_WIDTH=16 - -DUNITY_FLOAT_SUPPORT_DISABLED - -e - -Ol diff --git a/src/unity.h b/src/unity.h index 11d33e5..a067947 100644 --- a/src/unity.h +++ b/src/unity.h @@ -11,22 +11,27 @@ // Bus Width Management //------------------------------------------------------- -#if defined(BUS_WIDTH) && (BUS_WIDTH != 32) - #if (BUS_WIDTH == 16) - typedef unsigned char _UU8; - typedef unsigned int _UU16; - typedef unsigned long _UU32; - typedef signed char _US8; - typedef signed int _US16; - typedef signed long _US32; - #endif -#else +#ifndef INT_WIDTH +#define INT_WIDTH (32) +#endif + +#if (INT_WIDTH == 32) typedef unsigned char _UU8; typedef unsigned short _UU16; typedef unsigned int _UU32; typedef signed char _US8; typedef signed short _US16; typedef signed int _US32; +#elif (INT_WIDTH == 16) + typedef unsigned char _UU8; + typedef unsigned int _UU16; + typedef unsigned long _UU32; + typedef signed char _US8; + typedef signed int _US16; + typedef signed long _US32; +#else + #error Invalid INT_WIDTH specified! (32 or 16 only are currently supported) + #error Defaults to INT_WIDTH=32 if unspecified #endif