From: Ian Campbell Subject: Re: [PATCH 04/29] libxc/bitops: Add or() to the available bitmap operations Date: Thu, 11 Sep 2014 11:21:16 +0100 Message-ID: <1410430876.6166.61.camel@kazak.uk.xensource.com> References: <1410369067-1330-1-git-send-email-andrew.cooper3@citrix.com> <1410369067-1330-5-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1410369067-1330-5-git-send-email-andrew.cooper3@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: Ian Jackson , Xen-devel List-Id: xen-devel@lists.xenproject.org On Wed, 2014-09-10 at 18:10 +0100, Andrew Cooper wrote: > Signed-off-by: Andrew Cooper There's a bit of a trap here for callers wrt needing to make sure they are the same size (or at least both larger than nr_bits), but I think we can live with that. > CC: Ian Campbell > CC: Ian Jackson > --- > tools/libxc/xc_bitops.h | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/tools/libxc/xc_bitops.h b/tools/libxc/xc_bitops.h > index d8e0c16..dfce3b8 100644 > --- a/tools/libxc/xc_bitops.h > +++ b/tools/libxc/xc_bitops.h > @@ -60,4 +60,12 @@ static inline int test_and_set_bit(int nr, unsigned long *addr) > return oldbit; > } > > +static inline void bitmap_or(unsigned long *dst, const unsigned long *other, > + int nr_bits) > +{ > + int i, nr_longs = (bitmap_size(nr_bits) / sizeof(unsigned long)); Ah, this doesn't round down because bitnmap_size already rounds up. Good. Acked-by: Ian Campbell