typedef struct {Output: 04030201
uchar a,b,c,d;
}Char4;
Char4 y;
y.a=1; y.b=2; y.c=3; y.d=4;
vrState->dump[1] = *(uint *)&y;
char4 x=(char4)(1,2,3,4);
vrState->dump[0] = *(uint *)&x;
Output: 04030201
----
Test structure permutation:
typedef struct {
unsigned char a,b,g,r;
}Color;
vrState->color.r = 1;
vrState->color.g = 2;
vrState->color.b = 3;
vrState->color.a = 4;
define the same structure in host. Output:
Color rgba: 1 2 3 4
No comments:
Post a Comment