FIAS . Impressum . Privacy

foreach_bit

Matthias Kretz [please enable javascript to see the address]
Mon Aug 13 09:03:45 CEST 2012


On Thursday 09 August 2012 20:32:27 Kulakov, Igor wrote:
> Is this possible to break foreach_bit() like any other loop?
> 
> I mean something like:
> 
>  float_v a = ...;
>  Vc_foreach_bit(int i, a < 0.f) {
>    std::cout << a[i] << "\n";
>    if (a[i] > 0) break;
>  }

Good question. No, at least it's not guaranteed to work (it'll surely work 
with the Vc::Scalar :) ). I have an idea how it could be implemented, but I'll 
have to check how well the compilers optimize it.

Feel free to open a ticket at code.compeng.uni-frankfurt.de .

Background: Vc_foreach_bit is implemented as two nested for loops. Thus a 
break statement will only break out of the inner loop. This is has the same 
effect as a continue statement then.

Regards,
  	Matthias
-- 
Dipl.-Phys. Matthias Kretz
http://compeng.uni-frankfurt.de/?mkretz

SIMD easy and portable: http://compeng.uni-frankfurt.de/?vc



More information about the Vc mailing list
FIAS . Impressum . Privacy