Question about Vectors
    Charles via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Thu Nov 20 12:17:31 PST 2014
    
    
  
So I was reading the documentation page: 
http://dlang.org/simd.html and noticed what appears to be a typo:
int4 v;
(cast(int*)&v)[3] = 2;   // set 3rd element of the 4 int vector
(cast(int[4])v)[3] = 2;  // set 3rd element of the 4 int vector
v.array[3] = 2;          // set 3rd element of the 4 int vector
v.ptr[3] = 2;            // set 3rd element of the 4 int vector
v.array[3] = 2; and v.ptr[3] = 2; set the fourth element, and not 
the third.
As I was verifying this, I realized I had to compile it in 64 bit 
code. The 32 bit code produced the error "SIMD vector types not 
supported on this platform".
My test code is:
     void main() {
         import std.stdio;
         import core.simd;
         int4 v = 7;
         v.ptr[3] = 2;
         writeln(v.array[]);
     }
Is that related to me compiling while using a 64 bit OS, or is 
that true of any 32 bit OS, and thus, vectors can't be used in 
programs intended to be run on 32 bit OSs?
Thanks,
Charles
    
    
More information about the Digitalmars-d-learn
mailing list