Prevent wildcards from being accepted in filenames (NT mode)

Dimitrie O. Paun dpaun at rogers.com
Wed Nov 26 22:57:02 CST 2003


On November 26, 2003 11:22 pm, Dmitry Timoshkov wrote:
> (GetVersion() & 0x80000000)==0) construct is very inefficient. It forces
> compiler generate both a bit mask test and a comparison operation. While
> many modern processors have very effective bit test instructions, and
> we have to tell to the compiler that we want only a bit test.
>
> Simple !(GetVersion() & 0x80000000) is much better IMO.

Do you honestly think that a compiler can't figure out this is the
same thing?!? Even if it didn't, you'd be hard pressed to even measure
such minute differences, so no, it's not very inefficient by any means.

Case in point. The following program:

[dimi at dimi wine]$ cat temp.c
int a();
int b();
 
void c()
{
    if ( (a() & 0x8000000) == 0) b();
}
 
void d()
{
    if ( !(a() & 0x8000000)) b();
}

Compiled with gcc _without_ optimizations:

[dimi at dimi wine]$ gcc -c temp.c

yields _identical_ code for both c() and d():

[dimi at dimi wine]$ objdump -dS temp.o
 
temp.o:     file format elf32-i386
 
Disassembly of section .text:
 
00000000 <c>:
   0:   55                      push   %ebp
   1:   89 e5                   mov    %esp,%ebp
   3:   83 ec 08                sub    $0x8,%esp
   6:   e8 fc ff ff ff          call   7 <c+0x7>
   b:   25 00 00 00 08          and    $0x8000000,%eax
  10:   85 c0                   test   %eax,%eax
  12:   75 05                   jne    19 <c+0x19>
  14:   e8 fc ff ff ff          call   15 <c+0x15>
  19:   c9                      leave
  1a:   c3                      ret
 
0000001b <d>:
  1b:   55                      push   %ebp
  1c:   89 e5                   mov    %esp,%ebp
  1e:   83 ec 08                sub    $0x8,%esp
  21:   e8 fc ff ff ff          call   22 <d+0x7>
  26:   25 00 00 00 08          and    $0x8000000,%eax
  2b:   85 c0                   test   %eax,%eax
  2d:   75 05                   jne    34 <d+0x19>
  2f:   e8 fc ff ff ff          call   30 <d+0x15>
  34:   c9                      leave
  35:   c3                      ret


So while I prefer your version for stylistic reasons, I can't agree
with the spirit of the complaint.

-- 
Dimi.




More information about the wine-devel mailing list