From: MaartenBrock Date: Tue, 26 Sep 2006 19:40:27 +0000 (+0000) Subject: * src/z80/peeph.def: updated conditonals, fixed bug 1565908 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=dda4245dd181f12b29f533f18e9fada31abced24;p=fw%2Fsdcc * src/z80/peeph.def: updated conditonals, fixed bug 1565908 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4386 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index 921d5e8f..34aff335 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ * device/include/stdlib.h: added rand prototypes * device/lib/rand.c: new, added * device/lib/Makefile.in: added rand.c + * src/z80/peeph.def: updated conditonals, fixed bug 1565908 2006-09-20 Raphael Neider diff --git a/device/lib/rand.c b/device/lib/rand.c index 01c9f2c5..1a267194 100644 --- a/device/lib/rand.c +++ b/device/lib/rand.c @@ -29,7 +29,7 @@ static unsigned long int next = 1; int rand(void) { next = next * 1103515245UL + 12345; - return (unsigned int)(next/65536) % (RAND_MAX + 1); + return (unsigned int)(next/65536) % (RAND_MAX + 1U); } void srand(unsigned int seed) diff --git a/src/z80/peeph.def b/src/z80/peeph.def index 1ff4aa80..d94ffdd2 100644 --- a/src/z80/peeph.def +++ b/src/z80/peeph.def @@ -1,56 +1,56 @@ replace { - ld (hl),(hl) + ld (hl),(hl) } by { ERROR - peephole - caught (hl),(hl) } replace restart { - ld %1,%1 + ld %1,%1 } by { ; Removed redundent load } replace restart { - xor a,a - or a,%1 - or a,a - jp %2,%3 + xor a,a + or a,%1 + or a,a + jp %2,%3 } by { xor a,a or a,%1 jp %2,%3 } replace restart { - cp a,#0x00 - jp nz,%1 + cp a,#0x00 + jp NZ,%1 } by { or a,a - jp nz,%1 + jp NZ,%1 } replace restart { - jp nz,%1 + jp NZ,%1 jp %2 %1: jp %3 %2: } by { - jp z,%2 + jp Z,%2 %1: jp %3 %2: } replace restart { - jp nz,%1 + jp NZ,%1 jp %2 %1: } by { - jp z,%2 + jp Z,%2 %1: } replace restart { - jp z,%1 + jp Z,%1 jp %2 %1: } by { - jp nz,%2 + jp NZ,%2 %1: } replace restart { @@ -61,31 +61,31 @@ replace restart { } replace restart { or a,%1) - or a,a + or a,a } by { or a,%1) } replace restart { xor a,a or a,%1 - jp nz,%2 + jp NZ,%2 xor a,a or a,%3 - jp z,%2 + jp Z,%2 } by { xor a,a or a,%1 - jp nz,%2 + jp NZ,%2 or a,%3 - jp z,%2 + jp Z,%2 } replace restart { - jp nz,%1 + jp NZ,%1 inc %3) %1: jp %2 } by { - jp nz,%2 + jp NZ,%2 inc %3) %1: jp %2 @@ -94,7 +94,7 @@ replace restart { xor a,a ld a,#0x00 } by { - xor a,a + xor a,a } replace { ld e,#0x00 @@ -187,16 +187,16 @@ replace { replace { ld a,%1 sub a,#%2 - jp m,%3 + jp M,%3 ld a,%1 sub a,#%4 - jp p,%5 + jp P,%5 } by { ld a,%1 cp a,#%2 - jp m,%3 + jp M,%3 cp a,#%4 - jp p,%5 + jp P,%5 } replace { ld e,l