mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 2/3] add roundup and rounddown support
Date: Sat,  3 Nov 2012 21:58:29 +0100	[thread overview]
Message-ID: <1351976310-9312-2-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <1351976310-9312-1-git-send-email-plagnioj@jcrosoft.com>

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 include/linux/kernel.h |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index e9e2f07..92c3391 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -90,5 +90,20 @@
 	__val = __val < __min ? __min: __val;	\
 	__val > __max ? __max: __val; })
 
+
+/* The `const' in roundup() prevents gcc-3.3 from calling __divdi3 */
+#define roundup(x, y) (					\
+{							\
+	const typeof(y) __y = y;			\
+	(((x) + (__y - 1)) / __y) * __y;		\
+}							\
+)
+#define rounddown(x, y) (				\
+{							\
+	typeof(x) __x = (x);				\
+	__x - (__x % (y));				\
+}							\
+)
+
 #endif /* _LINUX_KERNEL_H */
 
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2012-11-03 21:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-03 20:56 [PATCH 0/3] i2c: add at24 eeprom support Jean-Christophe PLAGNIOL-VILLARD
2012-11-03 20:58 ` [PATCH 1/3] import log2 support from linux Jean-Christophe PLAGNIOL-VILLARD
2012-11-03 20:58   ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2012-11-03 20:58   ` [PATCH 3/3] eeprom: add at24 support Jean-Christophe PLAGNIOL-VILLARD
2012-11-12  7:38 ` [PATCH 0/3] i2c: add at24 eeprom support Sascha Hauer

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=1351976310-9312-2-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox