This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Optimize manual byte swap implementations -refreshed


Also of interest are constructions like

unsigned littleendian32(unsigned char *p)
{
  return p[3] << 24 | p[2] << 16 | p[1] << 8 | p[0];
}

unsigned bigendian32(unsigned char *p)
{
  return p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3];
}

which, ideally, would be converted to an (unaligned)
word read and a bswap depending on the native
endienness of the target.  Even more ideally, we'd
figure out that the word read may actually be aligned.

Yes that would be cool. The case is also described in PR27633.


Bye,

-Andreas-


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]