0

我想转换'unsigned char''uchar16'。起初,我直接转换它,但它运行错误。

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);

我在谷歌和 Stackoverflow 中搜索,并没有找到答案。

4

2 回答 2

1

For vector conversion in OpenCL there is the suite of functions:

convert_destType(sourceType)

See point 6.2.3 of the standard (v1.2). So in your case it would be:

uchar16 out = convert_uchar16(ciphertext);
于 2013-05-06T14:17:25.200 回答
1

你得到什么错误?

在这种情况下调用vload16更简单,通常更有效:

uchar16 u = vload16(0,ciphertext);
于 2013-05-04T17:41:09.943 回答