[U-Boot] cross compiling fw_printenv on big endian
Wolfgang Denk
wd at denx.de
Wed Mar 17 12:57:31 CET 2010
Dear Joakim Tjernlund,
In message <OFF4AB0804.BE309218-ONC12576E9.003A69DF-C12576E9.003B4D86 at transmode.se> you wrote:
>
> hmm, I recently discovered that normal user space headers always define
> both __LITTLE_ENDIAN and __BIG_ENDIAN so therefore a
> # ifdef __LITTLE_ENDIAN
> # define DO_CRC(x) crc = tab[(crc ^ (x)) & 255] ^ (crc >> 8)
> # else
> # define DO_CRC(x) crc = tab[((crc >> 24) ^ (x)) & 255] ^ (crc << 8)
> # endif
>
> Wont work. One have to use
> #if __BYTE_ORDER == __LITTLE_ENDIAN
> instead.
Wenn...
3ee8c120 (Joakim Tjernlund 2009-11-19 13:44:16 +0100 166) # ifdef __LITTLE_ENDIAN
3ee8c120 (Joakim Tjernlund 2009-11-19 13:44:16 +0100 167) # define DO_CRC(x) crc = tab[(crc ^ (x)) & 255] ^ (crc >> 8)
3ee8c120 (Joakim Tjernlund 2009-11-19 13:44:16 +0100 168) # else
3ee8c120 (Joakim Tjernlund 2009-11-19 13:44:16 +0100 169) # define DO_CRC(x) crc = tab[((crc >> 24) ^ (x)) & 255] ^ (crc << 8)
3ee8c120 (Joakim Tjernlund 2009-11-19 13:44:16 +0100 170) # endif
commit 3ee8c12071f0e3bdda25125b63c9d3fd54a7c9d8
Author: Joakim Tjernlund <Joakim.Tjernlund at transmode.se>
Date: Thu Nov 19 13:44:16 2009 +0100
crc32: Impl. linux optimized crc32()
Ported over the more efficient linux crc32() function.
A quick comparsion on ppc:
After changing the old crc32 to do 4 bytes in the
inner loop to be able to compare with new version one can note:
- old inner loop has 61 insn, new has 19 insn.
- new crc32 does one 32 bit load of data to crc while
the old does four 8 bits loads.
- size is bit bigger for the new crc32:
1392(old) 1416(new) of text. The is because the new version
shares code with crc32_no_comp() instead of duplicating code.
- about 33% faster on ppc:
New > crc 0 0xfffffff -> 39 secs
Old > crc 0 0xfffffff -> 60 secs
Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund at transmode.se>
Looks as if this were your very own commit. Do you have a fix in the
works?
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The manager will be continually amazed that policies he took for com-
mon knowledge are totally unknown by some member of his team. Since
his fundamental job is to keep everybody going in the same direction,
his chief daily task will be communication, not decision-making.
- Fred Brooks, "The Mythical Man Month"
More information about the U-Boot
mailing list