Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:49:06

0001 // name=qgs_test ; gcc $name.cc -std=c++11 -lstdc++ -I.. -I../../sysrap -I/usr/local/cuda/include -o /tmp/$name && /tmp/$name
0002 /**
0003 qgs_test.cc
0004 ==============
0005 
0006 Using union to call things by different names::
0007 
0008     What's in a name? That which we call a rose
0009     By any other name would smell as sweet;
0010 
0011 * when loading and saving in and out of buffers the quad6 lingo is most convenient.
0012 * when using the genstep the more specific naming from 
0013   the same storage struct is more convenient. 
0014 
0015 **/
0016 #include "vector_types.h"
0017 #include "scuda.h"
0018 #include "squad.h"
0019 
0020 //#include "qgs.h"
0021 
0022 struct TO
0023 {
0024     unsigned gencode ; 
0025     unsigned q0_y ; 
0026     unsigned q0_z ; 
0027     unsigned q0_w ;
0028 
0029     quad q1 ; 
0030     quad q2 ; 
0031     quad q3 ; 
0032     quad q4 ;
0033  
0034     float q5x ; 
0035     float q5y ; 
0036     float q5z ; 
0037     float q5w ; 
0038 }; 
0039 
0040 struct QT
0041 {
0042     union 
0043     {
0044         quad6 q ; 
0045         TO    t ; 
0046     }; 
0047 }; 
0048 
0049 
0050 int main(int argc, char** argv)
0051 {
0052     quad6 gs ; 
0053     gs.zero(); 
0054 
0055     gs.q0.u = make_uint4( 1u, 2u, 3u, 4u ); 
0056     gs.q5.f = make_float4( 1.f, 2.f, 3.f, 4.f ); 
0057 
0058     QT qt ; 
0059     qt.q = gs ; 
0060    
0061     printf("// qt.t.gencode  %d \n", qt.t.gencode  ); 
0062     printf("// qt.t.q5w      %10.4f \n", qt.t.q5w ); 
0063 
0064     return 0 ; 
0065 }