Message-Id: <200005221901.PAA30815@delorie.com> From: "Dieter Buerssner" To: djgpp-workers AT delorie DOT com Date: Mon, 22 May 2000 21:06:55 +0200 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: Bug 314 In-reply-to: <392937F4.B78491A5@cyberoptics.com> X-mailer: Pegasus Mail for Win32 (v3.12b) Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On 22 May 00, at 8:36, Eric Rudd wrote: > I have done my own testing, and believe that these modified routines now conform > to the requirements of ANSI, but I would appreciate it if someone else took a > look at the code and verified that the new code is indeed correct. The patch seems correct. BTW. Have you sent the same patch twice, or do I need some glasses? I think, the same patch is needed for ldiv and lldiv. Perhaps you wanted to sen those. *** src/libc/ansi/stdlib/ldiv.old Sat Dec 10 22:34:08 1994 --- src/libc/ansi/stdlib/ldiv.c Mon May 22 21:02:06 2000 *************** *** 1,4 **** ! /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ #include ldiv_t --- 1,4 ---- ! /* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */ #include ldiv_t *************** *** 6,25 **** { ldiv_t r; - if (num > 0 && denom < 0) - { - num = -num; - denom = -denom; - } - r.quot = num / denom; r.rem = num % denom; ! if (num < 0 && denom > 0) ! { ! if (r.rem > 0) ! { ! r.quot++; ! r.rem -= denom; ! } ! } return r; } --- 6,12 ---- { ldiv_t r; r.rem = num % denom; ! r.quot = num / denom; return r; } *** src/libc/ansi/stdlib/lldiv.old Sat May 18 14:53:42 1996 --- src/libc/ansi/stdlib/lldiv.c Mon May 22 21:02:18 2000 *************** *** 1,4 **** ! /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ #include --- 1,4 ---- ! /* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ #include *************** *** 7,26 **** { lldiv_t r; - if (num > 0 && denom < 0) - { - num = -num; - denom = -denom; - } - r.quot = num / denom; r.rem = num % denom; ! if (num < 0 && denom > 0) ! { ! if (r.rem > 0) ! { ! r.quot++; ! r.rem -= denom; ! } ! } return r; } --- 7,13 ---- { lldiv_t r; r.rem = num % denom; ! r.quot = num / denom; return r; }