Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply patch to fix serialization on ARM. #8

Merged
merged 1 commit into from
Mar 5, 2013
Merged

Apply patch to fix serialization on ARM. #8

merged 1 commit into from
Mar 5, 2013

Conversation

ahendrix
Copy link

@ahendrix ahendrix commented Mar 5, 2013

Apply patch ask_arm_flag_serialization.h.diff from https://code.ros.org/trac/ros/ticket/2883

This fixes ros/ros_comm#184

dirk-thomas added a commit that referenced this pull request Mar 5, 2013
Apply patch to fix serialization on ARM.
@dirk-thomas dirk-thomas merged commit 814da65 into ros:groovy-devel Mar 5, 2013
@sem23
Copy link

sem23 commented Mar 5, 2013

--- ./include/ros/serialization.h   2013-03-05 10:07:18.210946502 +0100
+++ ./patch/serialization.h 2013-03-05 10:03:51.195321502 +0100
@@ -170,6 +170,7 @@
   return Serializer::serializedLength(t);
 }
 
+#if (!(defined __ARMEL__ && defined __VFP_FP__))
 #define ROS_CREATE_SIMPLE_SERIALIZER(Type) \
   template<> struct Serializer \
   { \
@@ -188,6 +189,26 @@
       return sizeof(Type); \
     } \
   };
+#else
+#define ROS_CREATE_SIMPLE_SERIALIZER(Type) \
+  template<> struct Serializer \
+  { \
+    template inline static void write(Stream& stream, const Type v) \
+    { \
+      memcpy((void*)stream.advance(sizeof(v)), (const void*) &v, sizeof(v)); \
+    } \
+    \
+    template inline static void read(Stream& stream, Type& v) \
+    { \
+      memcpy((void*)&v, (const void*) stream.advance(sizeof(v)), sizeof(v)); \
+    } \
+    \
+    inline static uint32_t serializedLength(const Type&) \
+    { \
+      return sizeof(Type); \
+    } \
+  };
+#endif
 
 ROS_CREATE_SIMPLE_SERIALIZER(uint8_t);
 ROS_CREATE_SIMPLE_SERIALIZER(int8_t);

@dirk-thomas
Copy link
Member

A patch was already committed to roscpp_core as references above. Please take a look to that patch and comment if you think it needs further tweaking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants