--- Digest-Hashcash/Hashcash.xs 2003/10/20 04:17:05 1.4 +++ Digest-Hashcash/Hashcash.xs 2003/10/20 04:31:25 1.5 @@ -21,6 +21,11 @@ * it here and there, though. */ +/* + * we have lots of micro-optimizations here, this is just for toying + * around... + */ + /* don't expect _too_ much from compilers for now. */ #if __GNUC__ > 2 # define restrict __restrict__ @@ -33,6 +38,18 @@ # define inline #endif +#if __GNUC__ < 2 +# define __attribute__(x) +#endif + +#ifdef __i386 +# define a_regparm(n) __attribute__((__regparm__(n))) +#else +# define a_regparm(n) +#endif + +#define a_const __attribute__((__const__)) + /* Useful defines & typedefs */ #if defined(U64TYPE) && (defined(USE_64_BIT_INT) || ((BYTEORDER != 0x1234) && (BYTEORDER != 0x4321))) @@ -53,7 +70,7 @@ #elif __GNUC__ > 2 && __GNUC_MINOR__ > 3 # define zprefix(n) (__extension__ ({ uint32_t n__ = (n); n ? __builtin_clz (n) : 32; })) #else -static int zprefix (ULONG n) +static int a_const zprefix (ULONG n) { static char zp[256] = { @@ -131,10 +148,10 @@ #define FT(n) \ A = T32(R32(B,5) + f##n(C,D,E) + T + *WP++ + CONST##n); C = R32(C,30) -static void sha_transform(SHA_INFO *restrict sha_info) +static void a_regparm(1) sha_transform(SHA_INFO *restrict sha_info) { int i; - U8 *dp; + U8 *restrict dp; ULONG T, A, B, C, D, E, W[80], *restrict WP; dp = sha_info->data;