Sebastian Kloska <[EMAIL PROTECTED]>: >> Please provide example inputs where the results differ. A single a, b >> pair is enough.
> The program iterates through all a's and and b's from 0->0xFFFF > That should be sufficient Given that you already ran the program and don't have to fight with the bogus linebreaks added by you MUA, it surely would have been simpler to just provide an example value (e.g. a = 0x8000, b = 0x0002) ... Anyway, the problem is that your program does not use the macro the way it is supposed to be used. Both the temporary variable 'ul' and the result variable 'r' must be 32 bit wide. (But only the lower 16 bits of the result are valid, the other bits are to be ignored.) Note the "r-=((r)>>16);" in the idea_mul macro. This corresponds to the "+((ul&0xffff) < (ul>>16))" that you thought was omitteded: After the first assignment to r, the value (r)>>16 is 0xFFFF or 0x0000. (There may be more bits on the left [64-bit architectures], but they don't matter.) #define idea_mul(r,a,b,ul) \ ul=(unsigned long)a*b; \ if (ul != 0) \ { \ r=(ul&0xffff)-(ul>>16); \ r-=((r)>>16); \ } \ else \ r=(-(int)a-b+1); /* assuming a or b is 0 and in range */ \ ______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]