How to understand the comment of macro *compute_indices*?
Hello, Macro *compute_indices* in arch/arm64/kernel/head.S have a comment as shown below: mov \istart, \ptrs mul \istart, \istart, \count add \iend, \iend, \istart // iend += (count - 1) * ptrs I am wondering whether this comment should be change to "iend += count * ptrs". Or am I misunderstanding this code? Thanks -Lio
On Tue, 14 Jul 2020 07:54:04 +0800, carver said:
Hello,
Macro *compute_indices* in arch/arm64/kernel/head.S have a comment as shown below: mov \istart, \ptrs mul \istart, \istart, \count add \iend, \iend, \istart // iend += (count - 1) * ptrs
I am wondering whether this comment should be change to "iend += count * ptrs".
Examine the uses of the macro, and see where they expect the result to be pointing if there is exactly one entry. (Hint - what's the address of the first entry of a C array, and what's the next location after the array, and how would the corresponding C code for iterating across the array have as the termination condition?)
participants (2)
-
carver -
Valdis Klētnieks