ternary operator for clang's extended vectors

后端 未结 3 1134
孤街浪徒
孤街浪徒 2021-01-24 02:38

I\'ve tried playing with clang\'s extended vectors. The ternary operator is supposed to work, but it is not working for me. Example:

int main()
{
  using int4 =          


        
3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-24 03:31

    This works in a pinch:

    auto const diff = a-b;
    auto const ra( - (diff!=zero) * a - (diff==zero) *b);
    

    I guess this is a bug in the compiler, or in the documentation you linked.

提交回复
热议问题