On Tue, Apr 03, 2018 at 12:33:05PM -0400, David Miller wrote:
> Yes Al, however the pattern choosen here is probably cheaper on little endian:
>
> __beXX val = x;
> switch (val) {
> case htons(ETH_P_FOO):
> ...
> }
>
> This way only the compiler byte swaps the constants at compile time,
> no code is actually generated to do it.That's not obvious, actually - depends upon how sparse the switch ends up being. You can easily lose more than a single byteswap insn on worse cascase of comparisons.
