Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/Geant4/tools/carray is written in an unsupported language. File is not indexed.

0001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
0002 // See the file tools.license for terms.
0003 
0004 #ifndef tools_carray
0005 #define tools_carray
0006 
0007 //fixed array manips
0008 
0009 namespace tools {
0010 
0011 template <class T,class I>
0012 inline T* _4s_to_3s(const T* a_4s,const I& a_w,const I& a_h) {
0013   T* _3s = new T[a_w*a_h*3];
0014   if(!_3s) return 0;
0015   T* pfrom = (T*)a_4s;
0016   T* pto = _3s;
0017  {I _sz = a_w*a_h*4;
0018   for(I i=0;i<_sz;i+=4) {
0019     *(pto+0) = *(pfrom+0);
0020     *(pto+1) = *(pfrom+1);
0021     *(pto+2) = *(pfrom+2);
0022     pfrom += 4;
0023     pto += 3;
0024   }}
0025   return _3s;
0026 }
0027 
0028 }
0029 
0030 #endif