All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot-Users] [Q] memtest doubt
@ 2008-02-06 23:48 Guennadi Liakhovetski
  2008-02-07 13:34 ` Jerry Van Baren
  0 siblings, 1 reply; 5+ messages in thread
From: Guennadi Liakhovetski @ 2008-02-06 23:48 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-02-07 14:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-06 23:48 [U-Boot-Users] [Q] memtest doubt Guennadi Liakhovetski
2008-02-07 13:34 ` Jerry Van Baren
2008-02-07 13:45   ` Guennadi Liakhovetski
2008-02-07 14:23     ` Jerry Van Baren
2008-02-07 14:58       ` Guennadi Liakhovetski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.