I have the following code:
void palette(char* in, int* out, int* palette, int n) {
for(int i = 0; i < n ; ++i)
{
int value = palette[in[i]];
out[i] = value;
}
}
Here's the compiler code generated https://godbolt.org/z/x3nvrW I'm wondering if it possible to generate better assembly, since in and out data are pointing to different memory locations. Is there some "aliasing" info I can inject into the code so that assembly generated is better ? (i can't really understand the output of godbolt)
edit : my question would actually be:
- knowing that there is no aliasing, can I manually write faster assembly?
- how can I make standard (or non standard) C++ code generate this assembly ?