From 97fb43d7570886aadc7c6ea0ba68b7ffe04b75cb Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Sat, 30 Jul 2005 05:11:39 +0000 Subject: [PATCH] *** empty log message *** --- ase/macros.h | 9 +++++++-- ase/stx/dict.c | 8 +++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ase/macros.h b/ase/macros.h index a35af6d7..aef2619a 100644 --- a/ase/macros.h +++ b/ase/macros.h @@ -1,5 +1,5 @@ /* - * $Id: macros.h,v 1.29 2005-07-27 11:09:46 bacon Exp $ + * $Id: macros.h,v 1.30 2005-07-30 05:11:39 bacon Exp $ */ #ifndef _XP_MACROS_H_ @@ -33,7 +33,12 @@ ((XP_TYPE_IS_SIGNED(type)? (type)((type)1 << (xp_sizeof(type) * 8 - 1)): (type)0)) #define XP_NUM_IS_POWOF2(x) (((x) & ((x) - 1)) == 0) -#define XP_SWAP(x,y) ((x) ^= (y) ^= (x) ^= (y)) +#define XP_SWAP(x,y,original_type,casting_type) \ + do { \ + x = (original_type)((casting_type)(x) ^ (casting_type)(y)); \ + y = (original_type)((casting_type)(y) ^ (casting_type)(x)); \ + x = (original_type)((casting_type)(x) ^ (casting_type)(y)); \ + } while (0) #define XP_ABS(x) ((x) < 0? -(x): (x)) #define XP_LOOP_CONTINUE(id) goto __loop_ ## id ## _begin__; diff --git a/ase/stx/dict.c b/ase/stx/dict.c index 1ebc643e..313c551f 100644 --- a/ase/stx/dict.c +++ b/ase/stx/dict.c @@ -1,5 +1,5 @@ /* - * $Id: dict.c,v 1.5 2005-07-19 16:09:34 bacon Exp $ + * $Id: dict.c,v 1.6 2005-07-30 05:11:39 bacon Exp $ */ #include @@ -94,8 +94,10 @@ static void __dict_grow (xp_stx_t* stx, xp_word_t dict) /* TODO: explore if dict can be immediately destroyed. */ - XP_SWAP ((xp_uint_t)XP_STX_OBJECT(stx,dict), - (xp_uint_t)XP_STX_OBJECT(stx,new)); + xp_assert (xp_sizeof(xp_stx_object_t*) == xp_sizeof(xp_uint_t)); + XP_SWAP (XP_STX_OBJECT(stx,dict), + XP_STX_OBJECT(stx,new), + xp_stx_object_t*, xp_uint_t); } xp_word_t xp_stx_dict_lookup (