File indexing completed on 2026-04-09 07:49:31
0001 #pragma once
0002 #include "scuda.h"
0003
0004
0005 struct U4 {
0006 unsigned char x ;
0007 unsigned char y ;
0008 unsigned char z ;
0009 unsigned char w ;
0010 };
0011
0012 union U4U {
0013 U4 u4 ;
0014 unsigned u ;
0015 };
0016
0017
0018
0019
0020 struct C4 {
0021 char x ;
0022 char y ;
0023 char z ;
0024 unsigned char w ;
0025 };
0026
0027 union C4U {
0028 C4 c4 ;
0029 unsigned u ;
0030 };
0031
0032
0033 #if defined(__CUDACC__) || defined(__CUDABE__)
0034 #else
0035
0036 #include <sstream>
0037 #include <string>
0038 #include <iostream>
0039 #include <iomanip>
0040
0041
0042
0043 inline std::string C4U_desc( const C4U& c4u )
0044 {
0045 std::stringstream ss ;
0046 ss << " C4U ( "
0047 << std::setw(5) << int(c4u.c4.x)
0048 << std::setw(5) << int(c4u.c4.y)
0049 << std::setw(5) << int(c4u.c4.z)
0050 << std::setw(5) << unsigned(c4u.c4.w)
0051 << " ) "
0052 ;
0053 std::string s = ss.str();
0054 return s ;
0055 }
0056
0057 inline std::string C4U_desc( unsigned u )
0058 {
0059 C4U c4u ;
0060 c4u.u = u ;
0061
0062 return C4U_desc( c4u );
0063 }
0064
0065 inline std::string C4U_desc( const int4& gsid )
0066 {
0067 std::stringstream ss ;
0068 ss << " C4U ( "
0069 << std::setw(5) << gsid.x
0070 << std::setw(5) << gsid.y
0071 << std::setw(5) << gsid.z
0072 << std::setw(5) << gsid.w
0073 << " ) "
0074 ;
0075 std::string s = ss.str();
0076 return s ;
0077 }
0078
0079
0080
0081 inline std::string C4U_name( const int4& gsid, const char* prefix, char delim )
0082 {
0083 std::stringstream ss ;
0084 ss << prefix
0085 << delim
0086 << gsid.x << delim
0087 << gsid.y << delim
0088 << gsid.z << delim
0089 << gsid.w
0090 ;
0091 std::string s = ss.str();
0092 return s ;
0093 }
0094 inline void C4U_decode( int4& gsid, unsigned u )
0095 {
0096 C4U c4u ;
0097 c4u.u = u ;
0098
0099 gsid.x = int(c4u.c4.x) ;
0100 gsid.y = int(c4u.c4.y) ;
0101 gsid.z = int(c4u.c4.z) ;
0102 gsid.w = int(c4u.c4.w) ;
0103 }
0104
0105
0106 inline std::string C4U_name( unsigned gsid_ , const char* prefix, char delim )
0107 {
0108 int4 gsid ;
0109 C4U_decode( gsid, gsid_ );
0110 return C4U_name( gsid, prefix, delim );
0111 }
0112
0113
0114
0115
0116 #endif
0117