From 72f2be9f6713cdb2bbc6596ef556ed52491c8b0b Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Wed, 7 Feb 2007 14:08:07 +0000 Subject: [PATCH] *** empty log message *** --- ase/awk/func.c | 15 ++------------- ase/macros.h | 17 ++++++++++++++--- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/ase/awk/func.c b/ase/awk/func.c index 9638c688..8b21782f 100644 --- a/ase/awk/func.c +++ b/ase/awk/func.c @@ -1,5 +1,5 @@ /* - * $Id: func.c,v 1.94 2007-02-07 07:17:02 bacon Exp $ + * $Id: func.c,v 1.95 2007-02-07 14:08:07 bacon Exp $ * * {License} */ @@ -20,18 +20,7 @@ static int __bfn_match (ase_awk_run_t*, const ase_char_t*, ase_size_t); static int __bfn_sprintf (ase_awk_run_t*, const ase_char_t*, ase_size_t); #undef MAX -#if defined(__HP_cc) - #if ASE_SIZEOF_VOID_P == 4 - #define MAX 0xFFFFFFFFlu - #elif ASE_SIZEOF_VOID_P == 8 - #define MAX 0xFFFFFFFFFFFFFFFFllu - #else - #define MAX ASE_TYPE_MAX(ase_size_t) - #endif -#else - #define MAX ASE_TYPE_MAX(ase_size_t) -#endif - +#define MAX ASE_TYPE_UNSIGNED_MAX(ase_size_t) static ase_awk_bfn_t __sys_bfn[] = { diff --git a/ase/macros.h b/ase/macros.h index fec72e45..59c94bdb 100644 --- a/ase/macros.h +++ b/ase/macros.h @@ -1,5 +1,5 @@ /* - * $Id: macros.h,v 1.45 2007-02-03 10:52:36 bacon Exp $ + * $Id: macros.h,v 1.46 2007-02-07 14:04:34 bacon Exp $ * * {License} */ @@ -24,18 +24,29 @@ #define ASE_TYPE_IS_SIGNED(type) (((type)0) > ((type)-1)) #define ASE_TYPE_IS_UNSIGNED(type) (((type)0) < ((type)-1)) + +#define ASE_TYPE_SIGNED_MAX(type) \ + ((type)~((type)1 << (ASE_SIZEOF(type) * 8 - 1))) +#define ASE_TYPE_UNSIGNED_MAX(type) ((type)(~(type)0)) + +#define ASE_TYPE_SIGNED_MIN(type) \ + ((type)((type)1 << (ASE_SIZEOF(type) * 8 - 1))) +#define ASE_TYPE_UNSIGNED_MIN(type) ((type)0) + #define ASE_TYPE_MAX(type) \ - ((ASE_TYPE_IS_SIGNED(type)? (type)~((type)1 << (ASE_SIZEOF(type) * 8 - 1)): (type)(~(type)0))) + ((ASE_TYPE_IS_SIGNED(type)? ASE_TYPE_SIGNED_MAX(type): ASE_TYPE_UNSIGNED_MAX(type))) #define ASE_TYPE_MIN(type) \ - ((ASE_TYPE_IS_SIGNED(type)? (type)((type)1 << (ASE_SIZEOF(type) * 8 - 1)): (type)0)) + ((ASE_TYPE_IS_SIGNED(type)? ASE_TYPE_SIGNED_MIN(type): ASE_TYPE_UNSIGNED_MIN(type))) #define ASE_IS_POWOF2(x) (((x) & ((x) - 1)) == 0) + #define ASE_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 ASE_ABS(x) ((x) < 0? -(x): (x)) #define ASE_LOOP_CONTINUE(id) goto __loop_ ## id ## _begin__;