We know that in the Linux kernel, different CPUs have different byte-order definitions for different CPUs.
This section of the year is mainly about: different CPUs, the definition of the individual bits is also different.
The Linux kernel version used for this analysis is: linux--3.0.0-12.
Arch/xxx/include/asm/bitsperlong.h: Bit length definition for different CPUs (XXX)
1) ARM (xxx=arm):
#include <asm-generic/bitsperlong.h>
(2) PowerPC (XXX=POWERPC)
#ifndef __asm_powerpc_bitsperlong_h
#define __asm_powerpc_bitsperlong_h
#if defined (__powerpc64__)
# define __bits_per_long 64
#else
# define __bits_per_long 32
#endif
#include <asm-generic/bitsperlong.h>
#endif/* __asm_powerpc_bitsperlong_h */
(3) X86 (xxx=x86)
#ifndef __asm_x86_bitsperlong_h
#define __asm_x86_bitsperlong_h
#ifdef __x86_64__
# define __bits_per_long 64
#else
# define __bits_per_long 32
#endif
#include <asm-generic/bitsperlong.h>
#endif/* __asm_x86_bitsperlong_h */
From the 3 examples above, it can be seen that three different CPUs differ in their respective bit length definitions.
Next we look at Asm-generic/bitsperlong.h, the source code is as follows
#ifndef __asm_generic_bits_per_long
#define __asm_generic_bits_per_long
/*
* There seems to be no on the detecting this automatically from user
* Space, so a bit architectures should override this in their
* Bitsperlong.h. In particular, a architecture that supports
* Both and a bit user space must not rely on Config_64bit
* To decide it, but rather check a compiler provided macro.
*/
#ifndef __bits_per_long
#define __bits_per_long 32
#endif
#endif/* __asm_generic_bits_per_long */
The header file describes a schema that supports 32 and 64-bit user space, and does not depend on config_64bit to determine the bit length, but rather examines the macros provided by the compiler.
Summary: That is, the first check arch/xxx/include/asm/bitsperlong.h, see whether the CPU defines a bit length, if not defined, according to Asm-generic/bitsperlong.h to decide.
(This example is defined as long as the arch/xxx/include/asm/bitsperlong.h is not defined, the asm-generic/bitsperlong.h defines a bit length of 32)
Linux source code Analysis of the bit length definition--bitsperlong.h