In message <[EMAIL PROTECTED]> you wrote:
> The envcrc.c does sizeof(unsigned long) when calculating the crc, but this
> is done with the build toolchain instead of the target toolchain, so if
> the build is a 64bit system but the target is 32bits, the size will
> obviously be wrong.  This introduces a sizeof.sh script to calculate the
> required sizeof() value of any type with any compiler.

It seems this script requires up to 64 runs  of  the  C  compiler.  I
consider this pretty expensive. Isn't there a cheaper way to do that?

Consider the simple logic used to decide between 32 versus 64 bit
pointer types - shouldn't this be sufficient here, too?

> --- /dev/null
> +++ b/tools/sizeof.sh
> @@ -0,0 +1,35 @@
> +#!/bin/sh
> +# Get the sizeof(type) for a compiler
> +
> +type="$*"
> +CC=${CC:-gcc}
> +
> +if [ -z "$type" ] ; then
> +     echo "Usage: sizeof.sh <type>" 1>&2
> +     exit 1
> +fi
> +
> +test_size() {
> +     cat <<-EOF > sizeof.c
> +     typedef $type ac__type_sizeof_;
> +     int main() {
> +             static int test_array [1 - 2 * !(((long int) (sizeof 
> (ac__type_sizeof_))) <= $size)];
> +             test_array [0] = 0;
> +             return 0;
> +     }
> +     EOF
> +     ${CC} -c sizeof.c >/dev/null 2>&1
> +     ret=$?
> +     rm -f sizeof.[co]
> +     return $ret
> +}

Are there no Copyrights / License conditions attached to  this  code?
Where exactly is it coming from?


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: [EMAIL PROTECTED]
...when fits of creativity run strong, more than  one  programmer  or
writer  has  been  known to abandon the desktop for the more spacious
floor.                                             - Fred Brooks, Jr.

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users

Reply via email to