| 53 | |
| 54 | |
| 55 | template<typename _Tp> static void writeElems(std::ostream& out, const _Tp* data, |
| 56 | int nelems, int cn, char obrace, char cbrace) |
| 57 | { |
| 58 | typedef typename DataType<_Tp>::work_type _WTp; |
| 59 | nelems *= cn; |
| 60 | for(int i = 0; i < nelems; i += cn) |
| 61 | { |
| 62 | if(cn == 1) |
| 63 | { |
| 64 | out << (_WTp)data[i] << (i+1 < nelems ? ", " : ""); |
| 65 | continue; |
| 66 | } |
| 67 | out << obrace; |
| 68 | for(int j = 0; j < cn; j++) |
| 69 | out << (_WTp)data[i + j] << (j+1 < cn ? ", " : ""); |
| 70 | out << cbrace << (i+cn < nelems ? ", " : ""); |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | |
| 75 | static void writeElems(std::ostream& out, const void* data, int nelems, int type, char brace) |