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

From: Herbert Rosmanith (herp@wildsau.idv-edu.uni-linz.ac.at)
Date: Fri Aug 31 2001 - 09:37:29 EST


> 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/



This archive was generated by hypermail 2b29 : Fri Aug 31 2001 - 21:00:34 EST