paparazzi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[paparazzi-commits] [5265] test of macro to swap order of bytes


From: Eric
Subject: [paparazzi-commits] [5265] test of macro to swap order of bytes
Date: Fri, 06 Aug 2010 16:43:52 +0000

Revision: 5265
          http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=5265
Author:   lamestllama
Date:     2010-08-06 16:43:52 +0000 (Fri, 06 Aug 2010)
Log Message:
-----------
test of macro to swap order of bytes 

Modified Paths:
--------------
    paparazzi3/trunk/sw/airborne/lisa/test/test_bswap.c

Modified: paparazzi3/trunk/sw/airborne/lisa/test/test_bswap.c
===================================================================
--- paparazzi3/trunk/sw/airborne/lisa/test/test_bswap.c 2010-08-06 15:37:31 UTC 
(rev 5264)
+++ paparazzi3/trunk/sw/airborne/lisa/test/test_bswap.c 2010-08-06 16:43:52 UTC 
(rev 5265)
@@ -13,7 +13,23 @@
     ((((uint32_t) n) >>  8) & 0x0000FF00) |         \
     ((((uint32_t) n) >> 24) & 0x000000FF) )
 
+#define MyByteSwap32_1(in, out) \
+    asm volatile ( \
+    "rev        %0, %1\n\t" \
+    : "=r" (out) \
+    : "r"(in) \
+);
 
+
+#define MyByteSwap16_1(in, out) \
+    asm volatile ( \
+    "rev16        %0, %1\n\t" \
+    : "=r" (out) \
+    : "r"(in) \
+);
+
+
+
 int main(void) {
 
   //  uint32_t foo = 0;
@@ -27,10 +43,11 @@
 
   uint16_t foo = 12345;
   uint16_t bar = MyByteSwap16(foo);
+  MyByteSwap16_1(foo,bar);
 
-
   uint32_t a = 23456;
   uint32_t b = MyByteSwap32(a);
+  MyByteSwap32_1(a,b);
 
   return 0;
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]