From: George Dunlap <george.dunlap@eu.citrix.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH] libxc/xentrace: Replace xc_tbuf_set_cpu_mask with CPU mask with xc_cpumap_t instead of uint32_t
Date: Tue, 17 Mar 2015 13:52:27 +0000 [thread overview]
Message-ID: <5508319B.70109@eu.citrix.com> (raw)
In-Reply-To: <1426279030-15482-1-git-send-email-konrad.wilk@oracle.com>
On 03/13/2015 08:37 PM, Konrad Rzeszutek Wilk wrote:
> +static int parse_cpumask(const char *arg)
> +{
> + xc_cpumap_t map;
> + uint32_t v, i;
> + int bits = 0;
> +
> + map = malloc(sizeof(uint32_t));
> + if ( !map )
> + return -ENOMEM;
> +
> + v = argtol(arg, 0);
> + for ( i = 0; i < sizeof(uint32_t) ; i++ )
> + map[i] = (v >> (i * 8)) & 0xff;
> +
> + for ( i = 0; v; v >>= 1)
> + bits += v & 1;
Uum, it looks like this is counting the 1-bits in v, not the total
number of bist. So "0x8000" would finish with bits == 1 ; but we would
this to finish with bits == 16, don't we?
Or am I confused?
-George
next prev parent reply other threads:[~2015-03-17 13:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-13 20:37 [PATCH] libxc/xentrace: Replace xc_tbuf_set_cpu_mask with CPU mask with xc_cpumap_t instead of uint32_t Konrad Rzeszutek Wilk
2015-03-17 13:52 ` George Dunlap [this message]
2015-03-17 16:07 ` Konrad Rzeszutek Wilk
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=5508319B.70109@eu.citrix.com \
--to=george.dunlap@eu.citrix.com \
--cc=konrad.wilk@oracle.com \
--cc=xen-devel@lists.xenproject.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 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.