public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Jeff Angielski <jeff@theptrgroup.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] env: fix endian ordering in crc table
Date: Wed, 17 Mar 2010 21:14:19 -0400	[thread overview]
Message-ID: <4BA17E6B.9030503@theptrgroup.com> (raw)


The crc table was being built as little endian for big endian
targets.  This would cause fw_printenv to always fail with
"Warning: Bad CRC, using default environment" messages.

Signed-off-by: Jeff Angielski <jeff@theptrgroup.com>
---
  lib_generic/crc32.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib_generic/crc32.c b/lib_generic/crc32.c
index 468b397..27335a3 100644
--- a/lib_generic/crc32.c
+++ b/lib_generic/crc32.c
@@ -163,7 +163,7 @@ const uint32_t * ZEXPORT get_crc_table()
  #endif

  /* 
========================================================================= */
-# ifdef __LITTLE_ENDIAN
+# if __BYTE_ORDER == __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)
-- 
1.6.3.3

-- 
Jeff Angielski
The PTR Group
www.theptrgroup.com

             reply	other threads:[~2010-03-18  1:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-18  1:14 Jeff Angielski [this message]
2010-03-18  6:55 ` [U-Boot] [PATCH] env: fix endian ordering in crc table Joakim Tjernlund

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BA17E6B.9030503@theptrgroup.com \
    --to=jeff@theptrgroup.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox