From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59964) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKL6s-0004ON-06 for qemu-devel@nongnu.org; Fri, 13 Sep 2013 00:36:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VKL6g-0005iD-GS for qemu-devel@nongnu.org; Fri, 13 Sep 2013 00:35:57 -0400 Received: from mail-lb0-x22e.google.com ([2a00:1450:4010:c04::22e]:49351) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKL6g-0005i1-8I for qemu-devel@nongnu.org; Fri, 13 Sep 2013 00:35:46 -0400 Received: by mail-lb0-f174.google.com with SMTP id w6so1629931lbh.19 for ; Thu, 12 Sep 2013 21:35:45 -0700 (PDT) From: Antony Pavlov Date: Fri, 13 Sep 2013 08:33:02 +0400 Message-Id: <1379046783-19382-2-git-send-email-antonynpavlov@gmail.com> In-Reply-To: <1379046783-19382-1-git-send-email-antonynpavlov@gmail.com> References: <1379046783-19382-1-git-send-email-antonynpavlov@gmail.com> Subject: [Qemu-devel] [RFC v2 1/2] include/qemu: introduce sizes.h List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Richard Henderson , Antony Pavlov , Aurelien Jarno , Stefan Weil The header file sizes.h is used in linux kernel, barebox bootloader and u-boot bootloader. It provides the short and easy-to-read names for power-of-two numbers. The numbers like this are othen used for memory range sizes. Signed-off-by: Antony Pavlov Reviewed-by: Aurelien Jarno Reviewed-by: Paolo Bonzini Reviewed-by: Stefan Weil Reviewed-by: Richard Henderson --- include/qemu/sizes.h | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 include/qemu/sizes.h diff --git a/include/qemu/sizes.h b/include/qemu/sizes.h new file mode 100644 index 0000000..a683b60 --- /dev/null +++ b/include/qemu/sizes.h @@ -0,0 +1,61 @@ +/* + * Handy size definitions + * + * Copyright (C) 2013 Antony Pavlov + * + * Inspired by linux/sizes.h + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef QEMU_SIZES_H +#define QEMU_SIZES_H + +#include + +#define SZ_1 BIT(0) +#define SZ_2 BIT(1) +#define SZ_4 BIT(2) +#define SZ_8 BIT(3) +#define SZ_16 BIT(4) +#define SZ_32 BIT(5) +#define SZ_64 BIT(6) +#define SZ_128 BIT(7) +#define SZ_256 BIT(8) +#define SZ_512 BIT(9) + +#define SZ_1K BIT(10) +#define SZ_2K BIT(11) +#define SZ_4K BIT(12) +#define SZ_8K BIT(13) +#define SZ_16K BIT(14) +#define SZ_32K BIT(15) +#define SZ_64K BIT(16) +#define SZ_128K BIT(17) +#define SZ_256K BIT(18) +#define SZ_512K BIT(19) + +#define SZ_1M BIT(20) +#define SZ_2M BIT(21) +#define SZ_4M BIT(22) +#define SZ_8M BIT(23) +#define SZ_16M BIT(24) +#define SZ_32M BIT(25) +#define SZ_64M BIT(26) +#define SZ_128M BIT(27) +#define SZ_256M BIT(28) +#define SZ_512M BIT(29) + +#define SZ_1G BIT(30) +#define SZ_2G BIT(31) + +#endif /* QEMU_SIZES_H */ -- 1.8.4.rc3