[vsipl++] Re: [vsipl++-csl] [patch] Vector assignment, sarsim bits

Mark Mitchell mark at codesourcery.com
Mon Sep 26 19:58:53 UTC 2005

Stefan Seefeld wrote:
> Mark Mitchell wrote:
>> A conforming compiler is required to promote to int.  See [expr]/9:
>> "Otherwise, the integral promotions shall be performed on both
>> operands".  There's nothing special about "^"; the usual arithmetic
>> conversions are applied to all operands of arithmetic binary operators,
>> like +, -, *, etc., and, as a result, the type of such expressions is
>> always at least as wide as "int".
> Considering this logic, I'm wondering why the VSIPL++ specs require
> two distinct versions of operator^, one doing a binary and the other
> a logical xor, depending on the operands having type bool or not.
> Isn't that inconsistent with the above ?

I'm sure that comes from VSIPL, but I'm not sure exactly why.  Perhaps
in VSIPL, "a lxor b" works even if "a" and "b" are of type "int"; i.e.,
maybe "a lxor b" is the C++ operation "bool(bool(a) ^ bool(b))".

Mark Mitchell
CodeSourcery, LLC
mark at codesourcery.com
(916) 791-8304

More information about the vsipl++ mailing list