2 32-bit addition used a register that held already-computed result bytes as temporary for upper bytes of literal operand.
10 #ifndef __SDCC_pdk14 // Lack of memory
12 #if ULONG_MAX == 0xffffffff
13 typedef unsigned long UINT4
;
14 #elif UINT_MAX == 0xffffffff
15 typedef unsigned UINT4
;
16 #elif USHRT_MAX == 0xffffffff
18 #error No suitable UINT4 type
21 void check(const char *format
, ...)
26 va_start (arg
, format
);
28 ASSERT(va_arg(arg
, UINT4
) == (i
? 0xd76ae33a : 0x67452301));
29 ASSERT(va_arg(arg
, UINT4
) == 0xefcdab89);
30 ASSERT(va_arg(arg
, UINT4
) == 0x98badcfe);
31 ASSERT(va_arg(arg
, UINT4
) == (i
> 1 ? 0xc8d2cb98 : 0x10325476));
38 void func(UINT4
*buf
, UINT4
*in
)
40 UINT4 a
= buf
[0], b
= buf
[1], c
= buf
[2], d
= buf
[3];
42 check("%lx %lx %lx %lx\n",a
,b
,c
,d
);
44 {( a
) += ((( ( b
) ) & ( ( c
) )) | ((~ ( b
) ) & ( ( d
) ))) + ( in
[ 0] ) + (UINT4
)( 3614090360 );} // Bug affected addition here
46 check("%lx %lx %lx %lx\n",a
,b
,c
,d
);
48 {( d
) += ((( ( a
) ) & ( ( b
) )) | ((~ ( a
) ) & ( ( c
) ))) + ( in
[ 1] ) + (UINT4
)( 3905402710 ); }
50 check("%lx %lx %lx %lx\n",a
,b
,c
,d
);
57 #ifndef __SDCC_pdk14 // Lack of memory
58 UINT4 buf
[] = {0x67452301,0xefcdab89,0x98badcfe,0x10325476};
59 UINT4 in
[] = {0x3ec3,0x0,0x3dc3,0x0,0x3ac3};