***** SUSPECTED SPAM ***** Re: [PATCH 06/49] libxfs: fix byte swapping on constants

Dave Chinner
2013-08-12T00:04:03Z

On Fri, Aug 02, 2013 at 08:51:52AM -0500, Mark Tinguely wrote:
> On 07/19/13 01:44, Dave Chinner wrote:
> >From: Dave Chinner<dchinner@redhat.com>
> >
> >The kernel code uses cpu_to_beXX() on constants in switch()
> >statements for magic numbers in the btree code. Th ebyte swapping
> >infratructure isn't hooked up to the proper byte swap macros to make
> >this work, so fix it and then swap all the generic btree code over
> >to match the kernel code.
> >
> >Signed-off-by: Dave Chinner<dchinner@redhat.com>
> >---
>
> sync to include/uapi/linux/swab.h and (IMO backwards) switch/case
> statements in xfs_allocbt_verify() like kernel commit ee1a47ab.

The reason they are done that way is so that the compiler evalutes
the byte swap rather than doing it at runtime. i.e runtime only
requires a comparisons, instead of a endian swap then a
comparison. Hence we end up with smaller, faster code...

Cheers,

Dave.
--
Dave Chinner
david@fromorbit.com