Skip to content

Instantly share code, notes, and snippets.

@kraiskil
Created December 12, 2013 13:50
Show Gist options
  • Save kraiskil/7928220 to your computer and use it in GitHub Desktop.
Save kraiskil/7928220 to your computer and use it in GitHub Desktop.
__attribute__((aligned(128)))
__constant char data[128];
kernel void test_as_type()
{
char aligner[0x70];
union { uint16 value; char raw[sizeof(uint16)]; } src;
printf("data@ %x\n", data);
printf("src@ %x\n", &src);
printf("aligner@ %x\n", aligner);
src.value = *((__constant uint16*)data);
for (size_t i = 0; i < 16; ++i)
printf("%d - %x \n", i, src.raw[i]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment