Skip to contentSkip to conversation

Bug in cpu_to_le32

DISCUSSION Matthew Wilcox 1 participant 1 message Nov 1, 2004

lore
Share & tools
lore
#0 lore raw

Grant Grundler spotted we weren't using the optimised byteswap routines on PA-RISC. Here's why:

include/linux/byteorder/generic.h:90:#define le32_to_cpu __le32_to_cpu include/linux/byteorder/big_endian.h:33:#define __le32_to_cpu(x) ___swab32((__force __u32)(__le32)(x)) and byteorder/swab.h:
#define ___swab32(x) \

({ \
        __u32 __x = (x); \
        ((__u32)( \
                (((__u32)(__x) & (__u32)0x000000ffUL) << 24) | \
                (((__u32)(__x) & (__u32)0x0000ff00UL) <<  8) | \
                (((__u32)(__x) & (__u32)0x00ff0000UL) >>  8) | \
                (((__u32)(__x) & (__u32)0xff000000UL) >> 24) )); \
})

So le32_to_cpu() doesn't use optimised assembler on any platform. And for all you using ext3 on i386 ...

include/linux/byteorder/generic.h:95:#define cpu_to_be32 __cpu_to_be32 include/linux/byteorder/little_endian.h:38:#define __cpu_to_be32(x) ((__force __be32)___swab32((x)))

So it's not being used there either. What is ___swabN() for anyway? It seems to be a duplicate of ___constant_swabN().

Signature · 6 lines
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain