Re: Accessing the vector elements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Oct 23, 2006, at 7:05 PM, Ian Lance Taylor wrote:

Aren Villanueva <aren@xxxxxxxxxxxxxxxxxxx> writes:

How would I access the vector elements in that vector float??
I can't seem to find any comprehensive information on this topic.

gcc doesn't implement [] for vectors.  The only way to access the
elements is something like:

    union
    {
      vectortype v;
      float af[4];
    } u;
    u.v = v;
    return u.af[0];

Ian

Or, alternatively:

vectortype v;

elementtype e = ((elementtype*)&v)[1]

-Chris

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux