From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:48818) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UO2Qg-0000GU-1P for qemu-devel@nongnu.org; Fri, 05 Apr 2013 04:55:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UO2Qb-0001aF-CA for qemu-devel@nongnu.org; Fri, 05 Apr 2013 04:55:25 -0400 Received: from mail-pd0-f181.google.com ([209.85.192.181]:54406) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UO2GH-0005hG-AN for qemu-devel@nongnu.org; Fri, 05 Apr 2013 04:44:41 -0400 Received: by mail-pd0-f181.google.com with SMTP id y10so1884501pdj.40 for ; Fri, 05 Apr 2013 01:44:40 -0700 (PDT) Sender: Peter Crosthwaite From: Peter Crosthwaite Date: Fri, 5 Apr 2013 18:43:40 +1000 Message-Id: In-Reply-To: References: In-Reply-To: References: Subject: [Qemu-devel] [PATCH v2 1/5] bitops: Add ONES macro List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, Peter Crosthwaite , mst@redhat.com, blauwirbel@gmail.com, kraxel@redhat.com, edgar.iglesias@gmail.com Little macro that just gives you N ones (justified to LSB). Signed-off-by: Peter Crosthwaite --- include/qemu/bitops.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/include/qemu/bitops.h b/include/qemu/bitops.h index affcc96..da47fc8 100644 --- a/include/qemu/bitops.h +++ b/include/qemu/bitops.h @@ -273,4 +273,6 @@ static inline uint64_t deposit64(uint64_t value, int start, int length, return (value & ~mask) | ((fieldval << start) & mask); } +#define ONES(num) ((num) == 64 ? ~0ull : (1ull << (num)) - 1) + #endif -- 1.7.0.4