2010-06-22 11:14 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/include/hbdefs.h
    + added HB_VMUINT_MAX macro

  * harbour/src/vm/hvm.c
  * harbour/src/vm/itemapi.c
    % use conditional #if compilation for code which depends on
      HB_SIZE range. It should eliminate dummy code and pacify
      warnings in some compilers.
      NOTE: do not forget to update such #if conditions when we
            switch to signed HB_SIZE type.
This commit is contained in:
Przemyslaw Czerpak
2010-06-22 09:14:54 +00:00
parent 22259e8cfe
commit 6a91dc422d
4 changed files with 26 additions and 0 deletions

View File

@@ -16,6 +16,18 @@
The license applies to all entries newer than 2009-04-28.
*/
2010-06-22 11:14 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbdefs.h
+ added HB_VMUINT_MAX macro
* harbour/src/vm/hvm.c
* harbour/src/vm/itemapi.c
% use conditional #if compilation for code which depends on
HB_SIZE range. It should eliminate dummy code and pacify
warnings in some compilers.
NOTE: do not forget to update such #if conditions when we
switch to signed HB_SIZE type.
2010-06-22 09:58 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/src/macro/macro.y
* harbour/src/macro/macro.yyh

View File

@@ -462,6 +462,7 @@ typedef HB_UCHAR HB_U8;
#if defined( HB_CLIPPER_INT_ITEMS )
# define HB_VMINT_MAX SHRT_MAX
# define HB_VMINT_MIN SHRT_MIN
# define HB_VMUINT_MAX USHRT_MAX
# define HB_VMLONG_MAX LONG_MAX
# define HB_VMLONG_MIN LONG_MIN
# define HB_VMULONG_MAX ULONG_MAX
@@ -471,6 +472,7 @@ typedef HB_UCHAR HB_U8;
#elif !defined( HB_LONG_LONG_OFF ) && ULONG_MAX == UINT_MAX
# define HB_VMINT_MAX INT_MAX
# define HB_VMINT_MIN INT_MIN
# define HB_VMUINT_MAX UINT_MAX
# define HB_VMLONG_MAX LONGLONG_MAX
# define HB_VMLONG_MIN LONGLONG_MIN
# define HB_VMULONG_MAX ULONGLONG_MAX
@@ -479,6 +481,7 @@ typedef HB_UCHAR HB_U8;
#else
# define HB_VMINT_MAX INT_MAX
# define HB_VMINT_MIN INT_MIN
# define HB_VMUINT_MAX UINT_MAX
# define HB_VMLONG_MAX LONG_MAX
# define HB_VMLONG_MIN LONG_MIN
# define HB_VMULONG_MAX ULONG_MAX

View File

@@ -6661,10 +6661,14 @@ void hb_vmPushLong( long lNumber )
void hb_vmPushSize( HB_ISIZ nNumber )
{
#if HB_SIZE_MAX <= HB_VMUINT_MAX
hb_vmPushInteger( ( int ) nNumber );
#else
if( HB_LIM_INT( nNumber ) )
hb_vmPushInteger( ( int ) nNumber );
else
hb_vmPushHBLong( nNumber );
#endif
}
static void hb_vmPushHBLong( HB_MAXINT lNumber )

View File

@@ -990,6 +990,12 @@ PHB_ITEM hb_itemPutNS( PHB_ITEM pItem, HB_ISIZ nNumber )
else
pItem = hb_itemNew( NULL );
#if HB_SIZE_MAX <= HB_VMUINT_MAX
pItem->type = HB_IT_INTEGER;
pItem->item.asInteger.value = nNumber;
/* EXP limit used intentionally */
pItem->item.asInteger.length = HB_INT_EXPLENGTH( nNumber );
#else
if( HB_LIM_INT( nNumber ) )
{
pItem->type = HB_IT_INTEGER;
@@ -1003,6 +1009,7 @@ PHB_ITEM hb_itemPutNS( PHB_ITEM pItem, HB_ISIZ nNumber )
pItem->item.asLong.value = nNumber;
pItem->item.asLong.length = HB_LONG_LENGTH( nNumber );
}
#endif
return pItem;
}