From: Richard Henderson <rth@twiddle.net>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 2/2] cputlb: Tidy memset of arrays
Date: Sat, 7 Dec 2013 10:44:52 +1300 [thread overview]
Message-ID: <1386366292-5340-2-git-send-email-rth@twiddle.net> (raw)
In-Reply-To: <1386366292-5340-1-git-send-email-rth@twiddle.net>
Don't duplicate the array length computation in the memset
when plain sizeof can produce the correct results.
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
cputlb.c | 2 +-
translate-all.c | 5 ++---
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/cputlb.c b/cputlb.c
index d2da404..9270055 100644
--- a/cputlb.c
+++ b/cputlb.c
@@ -57,7 +57,7 @@ void tlb_flush(CPUArchState *env, int flush_global)
cpu->current_tb = NULL;
memset(env->tlb_table, -1, sizeof(env->tlb_table));
- memset(env->tb_jmp_cache, 0, TB_JMP_CACHE_SIZE * sizeof (void *));
+ memset(env->tb_jmp_cache, 0, sizeof(env->tb_jmp_cache));
env->tlb_flush_addr = -1;
env->tlb_flush_mask = 0;
diff --git a/translate-all.c b/translate-all.c
index aeda54d..66755b1 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -699,11 +699,10 @@ void tb_flush(CPUArchState *env1)
CPU_FOREACH(cpu) {
CPUArchState *env = cpu->env_ptr;
- memset(env->tb_jmp_cache, 0, TB_JMP_CACHE_SIZE * sizeof(void *));
+ memset(env->tb_jmp_cache, 0, sizeof(env->tb_jmp_cache));
}
- memset(tcg_ctx.tb_ctx.tb_phys_hash, 0,
- CODE_GEN_PHYS_HASH_SIZE * sizeof(void *));
+ memset(tcg_ctx.tb_ctx.tb_phys_hash, 0, sizeof(tcg_ctx.tb_ctx.tb_phys_hash));
page_flush_tb();
tcg_ctx.code_gen_ptr = tcg_ctx.code_gen_buffer;
--
1.8.3.1
next prev parent reply other threads:[~2013-12-06 21:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-06 21:44 [Qemu-devel] [PATCH 1/2] cputlb: Use memset when flushing entries Richard Henderson
2013-12-06 21:44 ` Richard Henderson [this message]
2013-12-22 18:04 ` [Qemu-devel] [PATCH 2/2] cputlb: Tidy memset of arrays Aurelien Jarno
2013-12-22 18:04 ` [Qemu-devel] [PATCH 1/2] cputlb: Use memset when flushing entries Aurelien Jarno
2013-12-23 14:37 ` Andreas Färber
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=1386366292-5340-2-git-send-email-rth@twiddle.net \
--to=rth@twiddle.net \
--cc=qemu-devel@nongnu.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).