Author: J. Wesley Cleveland
Date: 14:11:29 09/15/01
Go up one level in this thread
On September 15, 2001 at 16:17:52, Vincent Diepeveen wrote: [snip] >Like if i check for 2 non-array/pointer entities for being zero: > >if( a & b ) > then do this and that; > >to produce some crap assembly: > CMP EAX,0 > JNZ LOOP > CMP EDX,0 > JNZ LOOP1 > >Now already people will complain: "you don't need special CMP for >2 different statements". Well they're right. > >In fact you don't need 2 compares even. All you need is something >primitive like: > > ADD EAX,EDX > CMP EAX,0 > JNZ LOOP1 > >However i would need to learn assembly for this or i must rewrite >my C code. The compiler isn't smart Bruce. The compiler is very stupid >when talking about source connections. So i have to write: > if( a+b ) > then do this and that; > Note that this fails if a+b = 2^32. It would be expecting too much for a compiler to know that this could not happen. Also, pointer notation can cause some code to run slower, because the compiler can not perform some optimizations because of possible pointer aliasing.
This page took 0.02 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.