Quoting Michael Buesch <[EMAIL PROTECTED]>: >> > I don't think so. Suppose rxhdr->mac_status is 1. le32_to_cpu() will >> > return 0x1000000, > > How would it return 0x1000000? > if mac_status is 1 in the lowest byte, le32_to_cpu would not put that 1 into > the highest byte of the result.
Actually, it would. On big-endian systems, conversion from little-endian to CPU order swaps bytes. Please note that referring to "the lowest byte" can be confusing. The least significant byte and the byte with the least address are not the same on big-endian systems. Besides, mac_status has a meaning for the CPU that is different from its meaning for the hardware in the hardware is little-endian but the CPU is not. What the hardware sees as 0x1000000, the CPU sees as 1 before the conversion. What is least significant for one is most significant for another, until the conversion is done. >> > which would turn into 0 on conversion to u16. >> > le16_to_cpu() will return 0x100. Since rxhdr->mac_status is accessed by >> > value (not by pointer), it will be 1 whether it's treated as 32-bit or >> > 16-bit. > > Ok, I didn't know it's passed by value. > I thought it was casted to pointer inline. > If it's passed to leX_to_cpu by value, of course it's a different story. OK. I'll leave my explanation anyway for benefit of other readers. -- Regards, Pavel Roskin _______________________________________________ Bcm43xx-dev mailing list Bcm43xx-dev@lists.berlios.de https://lists.berlios.de/mailman/listinfo/bcm43xx-dev