Ian Molton wrote: > Johan V. wrote: > >> I know it's very obscured. Think about the wasted clock cycles for a >> minute, the above can be implemented without conditional jumps ... > > More to the point though I think technically its broken. Im fairly sure > C only defines 0 to be false. *all* other values are true, therefore you > are relying on the compiler to use 1. > > also from an assembler standpoint, some CPUs may not be able to > implement reg = (a>0) without a branch. > > best to use conditionals and let the compiler work out how best to fit > them around the target CPU. (even better to go fix gcc so it does that > well)
It was the worst possible code I could come up with. So every critisism it gets is justified :) -- http://linuxfromscratch.org/mailman/listinfo/lfs-chat FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page
