Re: [IDEA+RFC] Possible solution for min()/max() war

Herbert Rosmanith (herp@wildsau.idv-edu.uni-linz.ac.at)
Fri, 31 Aug 2001 16:37:29 +0200 (MET DST)


> which compiles to:
>
> : movw $65535,-2(%ebp)
> : movb $-2,-3(%ebp)
> : xorl %eax,%eax
> : movw -2(%ebp),%ax
> : movsbl -3(%ebp),%edx
> : cmpl %edx,%eax
> : jle .L3
>
> you see this? short and char get expanded to 32bit int (I have a x86),
> and a signed comparison can be done without danger. "jle" jumps if
> SF != OF, which accounts to "op1 < op2" in a signed compare. the
> "unsigned short" quantum gets expanded to an "unsigned int", which
^^^^^^^^^^^^^^

yikes, this should really read "signed int".

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/