[kaffe] Re: Computing remainders

Dalibor Topic robilad at yahoo.com
Sun Jun 29 03:51:01 PDT 2003


--- Dalibor Topic <robilad at yahoo.com> wrote:

> Sounds good to me. That's similar to the route I'd like to go for the
> interpreter as well.
> 
> 1. make the current special case (#ifdef LONG_MODULO_BROKEN) the only case.
> That should fix powerpc, x86 and m68k.
> 2. remove the according configure.in checks. since they become unnecessary.
> 3. write configure.in checks to see if C / with negative args rounds to 0
> 4. write configure.in checks to see if C % with negative args is negative
> 5. implement Java / and % on those platforms where the checks above fail
> using
> my slow div_t based implementation.
> 6. put the division and remainder code in its own header file

I had a brief look over gcc 3.2 internals docs:


     The result of a `TRUNC_DIV_EXPR' is always rounded towards zero.
     The `TRUNC_MOD_EXPR' of two operands `a' and `b' is always `a -
     a/b' where the division is as if computed by a `TRUNC_DIV_EXPR'.

so as long as we are only using the gcc, there's no need for steps 3-6 ;)

cheers,
dalibor topic

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com




More information about the kaffe mailing list