WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Define ABS() library function. Use it.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Define ABS() library function. Use it.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 11 May 2010 03:30:37 -0700
Delivery-date: Tue, 11 May 2010 03:32:51 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1273573163 -3600
# Node ID 2077d6ad60780bbe0631c0dee1ef2e2b8eb03867
# Parent  e984d995f360d101b188fc4973243e2e4048e0c4
Define ABS() library function. Use it.

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/common/compat/memory.c |    2 +-
 xen/include/xen/lib.h      |    5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff -r e984d995f360 -r 2077d6ad6078 xen/common/compat/memory.c
--- a/xen/common/compat/memory.c        Tue May 11 11:10:24 2010 +0100
+++ b/xen/common/compat/memory.c        Tue May 11 11:19:23 2010 +0100
@@ -116,7 +116,7 @@ int compat_memory_op(unsigned int cmd, X
 
             start_extent = cmp.xchg.nr_exchanged;
             end_extent = (COMPAT_ARG_XLAT_SIZE - sizeof(*nat.xchg)) /
-                         (((1U << __builtin_abs(order_delta)) + 1) *
+                         (((1U << ABS(order_delta)) + 1) *
                           sizeof(*space));
             if ( end_extent == 0 )
             {
diff -r e984d995f360 -r 2077d6ad6078 xen/include/xen/lib.h
--- a/xen/include/xen/lib.h     Tue May 11 11:10:24 2010 +0100
+++ b/xen/include/xen/lib.h     Tue May 11 11:19:23 2010 +0100
@@ -39,6 +39,11 @@ do {                                    
 #else
 #define ASSERT(p) ((void)0)
 #endif
+
+#define ABS(_x) ({                              \
+    typeof(_x) __x = (_x);                      \
+    (__x < 0) ? -__x : __x;                     \
+})
 
 #define SWAP(_a, _b) \
    do { typeof(_a) _t = (_a); (_a) = (_b); (_b) = _t; } while ( 0 )

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Define ABS() library function. Use it., Xen patchbot-unstable <=