From: Guennadi Liakhovetski Date: Thu, 7 Feb 2008 00:48:54 +0100 (CET) Subject: [U-Boot-Users] [Q] memtest doubt Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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@least unusual to set the end address to anything other than start address + ((1 << x) - 1), but still. Thanks Guennadi --- Guennadi Liakhovetski