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-4.0-testing] Define ABS() library function. Use it.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-4.0-testing] Define ABS() library function. Use it.
From: "Xen patchbot-4.0-testing" <patchbot-4.0-testing@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 12 Aug 2010 02:45:21 -0700
Delivery-date: Thu, 12 Aug 2010 02:46:00 -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 1281541424 -3600
# Node ID 954754745f65f0a76519924184062958d62f6744
# Parent  1da5224a287564ac6f86faf8fea0c6a88faa4010
Define ABS() library function. Use it.

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
xen-unstable changeset:   21345:2077d6ad6078
xen-unstable date:        Tue May 11 11:19:23 2010 +0100
---
 xen/common/compat/memory.c |    2 +-
 xen/include/xen/lib.h      |    5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff -r 1da5224a2875 -r 954754745f65 xen/common/compat/memory.c
--- a/xen/common/compat/memory.c        Tue Aug 10 15:49:20 2010 +0100
+++ b/xen/common/compat/memory.c        Wed Aug 11 16:43:44 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 1da5224a2875 -r 954754745f65 xen/include/xen/lib.h
--- a/xen/include/xen/lib.h     Tue Aug 10 15:49:20 2010 +0100
+++ b/xen/include/xen/lib.h     Wed Aug 11 16:43:44 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-4.0-testing] Define ABS() library function. Use it., Xen patchbot-4.0-testing <=