This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Generating Modulo and Remainder Operations
- From: Erik <esigra at gmail dot com>
- To: Rohit Arul Raj <rohitarulraj at gmail dot com>
- Cc: gcc-help <gcc-help at gcc dot gnu dot org>
- Date: Tue, 27 Oct 2009 00:32:49 +0100
- Subject: Re: Generating Modulo and Remainder Operations
- References: <c356fd4e0910200532g41ea06a7r93109c0bc4bc9626@mail.gmail.com> <c356fd4e0910200542g61259a7apa5fad3719215e8a3@mail.gmail.com>
Rohit Arul Raj skrev:
> I have seen some notes that the results of Modulo and Remainder for
> integer operations are not the same. From the GCC code, i have seen
> that modulo and remainder give same results for unsigned data types
> and they are different only for signed data types.
>
> My question is how to write "C" statements to generate Modulo &
> Remainder operations.
>
You could just use Ada, which has both mod and rem operators. If you
need to use that code from an existing C program, it should work too.