kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: "Valdis Klētnieks" <valdis.kletnieks@vt.edu>
To: carver <carver.lio@hotmail.com>
Cc: kernelnewbies@kernelnewbies.org
Subject: Re: How to understand the comment of macro *compute_indices*?
Date: Mon, 13 Jul 2020 22:21:13 -0400	[thread overview]
Message-ID: <431735.1594693273@turing-police> (raw)
In-Reply-To: <KL1PR03MB49840A52005FD59C2D2FE6999A600@KL1PR03MB4984.apcprd03.prod.outlook.com>


[-- Attachment #1.1: Type: text/plain, Size: 687 bytes --]

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?)

[-- Attachment #1.2: Type: application/pgp-signature, Size: 832 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

      reply	other threads:[~2020-07-14  2:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-13 23:54 How to understand the comment of macro *compute_indices*? carver
2020-07-14  2:21 ` Valdis Klētnieks [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=431735.1594693273@turing-police \
    --to=valdis.kletnieks@vt.edu \
    --cc=carver.lio@hotmail.com \
    --cc=kernelnewbies@kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).