[macstl-dev] Re: Question about sized booleans

Glen Low glen.low at pixelglow.com
Tue Jul 19 08:10:44 WST 2005

  • Previous message: [macstl-dev] Question about sized booleans
  • Next message: [macstl-dev] Re: Question about sized booleans
  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]


On 19/07/2005, at 3:44 AM, Ilya Lipovsky wrote:

> Hi,
>
> Can I have this: "valarray <macstl::boolean <float> > and then  
> assign to it (vec1 < vec2), where vec1&vec2 are both of type  
> "valarray <float>"? I tried it and failed. Should valarray be  
> extended for sized booleans?

All valarray expressions that return a bool already chunk as the  
appropriate sized boolean e.g.

valarray <float> a, b;
a < b chunks as boolean <int>
valarray <short> c, d;
c < d chunks as boolean <short>

You just can't store them in a valarray <bool> yet, because bool is  
usually a fixed size on particular compilers/operating systems. You  
used to be able to assign a 4 byte element to valarray <bool> in  
0.1.x, but I had some problems when I changed the architecture on  
0.2.x so I had it #if 0'd out.

I'll consider your request as it makes sense. However do note that  
boolean <float> is only defined in SSE, to express the "subtle"  
difference between boolean <float> and boolean <int> -- they use  
different SSE logical operators, even though conceptually and  
register-wise they are identical. Someone on the simdtech list, I  
think it was Holger, theorized they might use different register  
files. We'd have to do a bit of inner type declaring to get it come  
out correctly e.g.

valarray <float>::boolean result = vec1 < vec2;

and declare the boolean type inside of valarray <float>. A little  
uncomfortable with this since this breaks compatibility with  
std::valarray -- any suggestions?

Cheers, Glen Low


---
pixelglow software | simply brilliant stuff
www.pixelglow.com
aim: pixglen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.pixelglow.com/lists/archive/macstl-dev/attachments/20050719/315e04a9/attachment-0001.html

  • Previous message: [macstl-dev] Question about sized booleans
  • Next message: [macstl-dev] Re: Question about sized booleans
  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

More information about the macstl-dev mailing list