All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antony Pavlov <antonynpavlov@gmail.com>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Antony Pavlov <antonynpavlov@gmail.com>,
	Aurelien Jarno <aurelien@aurel32.net>,
	Richard Henderson <rth@twiddle.net>
Subject: [Qemu-devel] [PATCH 1/2] include/qemu: introduce sizes.h
Date: Thu, 28 Nov 2013 10:29:11 +0400	[thread overview]
Message-ID: <1385620152-4368-2-git-send-email-antonynpavlov@gmail.com> (raw)
In-Reply-To: <1385620152-4368-1-git-send-email-antonynpavlov@gmail.com>

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 <antonynpavlov@gmail.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
---
 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 <antonynpavlov@gmail.com>
+ *
+ * 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 <qemu/bitops.h>
+
+#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.4

  reply	other threads:[~2013-11-28  6:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-28  6:29 [Qemu-devel] [PATCH 0/2] use sizes.h macros for power-of-two sizes Antony Pavlov
2013-11-28  6:29 ` Antony Pavlov [this message]
2013-11-28  6:29 ` [Qemu-devel] [PATCH 2/2] hw/mips: use sizes.h macros Antony Pavlov
2013-11-28 14:27   ` Andreas Färber
2013-11-29  6:06     ` Antony Pavlov
2013-11-28 17:08   ` Stefan Weil
2013-11-29  6:30     ` Antony Pavlov

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=1385620152-4368-2-git-send-email-antonynpavlov@gmail.com \
    --to=antonynpavlov@gmail.com \
    --cc=aurelien@aurel32.net \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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.