On Mon, Oct 26, 2020 at 8:56 PM Xie He <xie.he.0...@gmail.com> wrote: > > > - for (mem = (HDW *) memmap; mem < (HDW *) (memmap + 1); ++mem) > > + for (mem = (HDW *) memmap; mem < (HDW *) ((uintptr_t)memmap + 1); ++mem) > > Note that these two lines are semantically different. In the first line, > "+ 1" moves the pointer by (sizeof memmap) bytes. However in the second > line, "+ 1" moves the pointer by only 1 byte.
Correction: in the first line "+ 1" moves the pointer by (sizeof *memmap) bytes.