Messages in this thread | | | Date | Tue, 3 Apr 2018 17:45:45 +0100 | From | Al Viro <> | Subject | Re: [PATCH net 1/2] net: bcmgenet: Fix sparse warnings in bcmgenet_put_tx_csum() |
| |
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.
| |