Hi all,

looking through the common/cmd_mem.c::do_mem_mtest() function, I couldn't 
understand the following place:

                addr_mask = ((ulong)end - (ulong)start)/sizeof(vu_long);
...
                for (offset = 1; (offset & addr_mask) != 0; offset <<= 1) {
                        start[offset] = pattern;
                }

why (offset & addr_mask) != 0 and not just offset < addr_mask? Suppose

        end = 0xbf;
        start = 0;

        addr_mask = 0x2f;

The loop will iterate over offset = 1, 2, 4, 8, and on 0x10 it will abort 
and 0x10 and 0x20 will stay untested. Whereas if we just had "offset < 
addr_mask" it would just function correctly, wouldn't it? Yes, I do 
realise, that it is at least unusual to set the end address to anything 
other than start address + ((1 << x) - 1), but still.

Thanks
Guennadi
---
Guennadi Liakhovetski

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users

Reply via email to