[Freeciv-Dev] Re: [RFC] Path finding implementation.
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Mon, 22 Jul 2002, rf13@xxxxxxxxxxxxxxxxx wrote:
> On Mon, Jul 22, 2002 at 12:25:17AM +0200, Gaute B Strokkenes wrote:
>> On Sat, 29 Jun 2002, rf13@xxxxxxxxxxxxxxxxx wrote:
>> > On Fri, Jun 28, 2002 at 10:28:49PM +0100, Gregory Berkolaiko
>> > wrote:
>> >> Maybe my compiler does not optimize x % 128 to x | 127 ??
>>
>> You mean "x & 127".
>>
>> > gcc -S is your friend. But I'm sure that it does.
>
>> Only if x is an unsigned type, remember.
>
> $ cat a.c
> int f(int x) { return x%128;}
> $ gcc -O2 -S a.c
> $ cat a.s
$ cat a.c
int f(int x) { return x%128;}
$ gcc-3.0 -O2 -S a.c
$ cat b.c
int f(int x) { return ((unsigned) x)%128;}
$ gcc-3.0 -O2 -S b.c
$ diff -u a.s b.s
--- a.s Mon Jul 22 21:04:55 2002
+++ b.s Mon Jul 22 21:05:05 2002
@@ -1,4 +1,4 @@
- .file "a.c"
+ .file "b.c"
.text
.align 4
.globl f
@@ -7,18 +7,9 @@
pushl %ebp
movl %esp, %ebp
movl 8(%ebp), %eax
- testl %eax, %eax
- movl %eax, %edx
- js .L3
-.L2:
- andl $-128, %edx
- subl %edx, %eax
+ andl $127, %eax
popl %ebp
ret
- .p2align 2
-.L3:
- leal 127(%eax), %edx
- jmp .L2
.Lfe1:
.size f,.Lfe1-f
.ident "GCC: (GNU) 3.0.4"
> Please people try this before you say anything.
Boggle.
--
Big Gaute http://www.srcf.ucam.org/~gs234/
Does that mean I'm not a well-adjusted person??
- [Freeciv-Dev] Re: [RFC] Path finding implementation., (continued)
- [Freeciv-Dev] Re: [RFC] Path finding implementation., Raimar Falke, 2002/07/01
- [Freeciv-Dev] Re: [RFC] Path finding implementation., Gregory Berkolaiko, 2002/07/02
- [Freeciv-Dev] Re: [RFC] Path finding implementation., Raimar Falke, 2002/07/02
- [Freeciv-Dev] Re: [RFC] Path finding implementation., Gregory Berkolaiko, 2002/07/02
- [Freeciv-Dev] Re: [RFC] Path finding implementation., Raimar Falke, 2002/07/03
- [Freeciv-Dev] Re: [RFC] Path finding implementation., Raimar Falke, 2002/07/03
- [Freeciv-Dev] Re: [RFC] Path finding implementation., Raimar Falke, 2002/07/09
[Freeciv-Dev] Re: [RFC] Path finding implementation., Ross W. Wetmore, 2002/07/06
[Freeciv-Dev] Re: [RFC] Path finding implementation., Gaute B Strokkenes, 2002/07/21
[Freeciv-Dev] Re: [RFC] Path finding implementation., Gregory Berkolaiko, 2002/07/30
- [Freeciv-Dev] Re: [RFC] Path finding implementation., Raimar Falke, 2002/07/30
- [Freeciv-Dev] Re: [RFC] Path finding implementation., Gregory Berkolaiko, 2002/07/30
- [Freeciv-Dev] Re: [RFC] Path finding implementation., Raimar Falke, 2002/07/30
- [Freeciv-Dev] Re: [RFC] Path finding implementation., Gregory Berkolaiko, 2002/07/31
- [Freeciv-Dev] Re: [RFC] Path finding implementation., Raimar Falke, 2002/07/31
- [Freeciv-Dev] Re: [RFC] Path finding implementation., Gregory Berkolaiko, 2002/07/31
- [Freeciv-Dev] Re: [RFC] Path finding implementation., Raimar Falke, 2002/07/31
- [Freeciv-Dev] Re: [RFC] Path finding implementation., Gregory Berkolaiko, 2002/07/31
- [Freeciv-Dev] Re: [RFC] Path finding implementation., Raimar Falke, 2002/07/31
|
|