2013-05-04 2 views
0

'unsigned char' 'uchar16'로 변환하고 싶습니다. 처음에는 직접 변환하지만 오류가 발생합니다.opencl의 타입 변환

uchar16* out; 
unsigned char ciphertext[16]; 
/* 
* 
*/ 
out[0] = (uchar16)(ciphertext[0], ciphertext[1], ciphertext[2], ciphertext[3], 
     ciphertext[4], ciphertext[5], ciphertext[6], ciphertext[7], 
     ciphertext[8], ciphertext[9], ciphertext[10], ciphertext[11], 
     ciphertext[12], ciphertext[13], ciphertext[14], ciphertext[15]); 

변수 대신 실제 값을 사용하면 실행됩니다.

out[0] = (uchar16)(0x2B, 0x7E, 0x15, 0x16, 
    0x28, 0xAE, 0xD2, 0xA6, 
    0xAB, 0xF7, 0x15, 0x88, 
    0x09, 0xCF, 0x4F, 0x3C); 

Google과 Stackoverflow에서 검색 한 결과를 찾지 못했습니다.

+1

"out"에 대한 메모리를 할당하지 않을 것입니다. "uchar16 out [1];을 시도하십시오." 대신. –

답변

1

OpenCL을 벡터 변환을위한 기능의 제품군이있다 :

convert_destType(sourceType) 

포인트 6.2을 참조하십시오가. 3 표준 (v1.2). 따라서 귀하의 경우 :

uchar16 out = convert_uchar16(ciphertext); 
1

오류가 발생했습니다.

그것은 간단하고,이 경우 vload16를 호출 일반적으로 더 효율적입니다 :

uchar16 u = vload16(0,ciphertext);