src/dcf.c
changeset 200 930be51ddc24
parent 191 1e6e3d261b8f
child 202 9cfd9211616c
--- a/src/dcf.c	Mon May 14 11:24:32 2007 +0200
+++ b/src/dcf.c	Mon May 14 22:46:20 2007 +0200
@@ -23,6 +23,7 @@
 #include "objacces.h"
 #include "sdo.h"
 #include "dcf.h"
+#include "sysdep.h"
 
 const indextable *ptrTable;
 
@@ -69,26 +70,16 @@
 					d->dcf_cursor = dcf + 4;
 					d->dcf_count_targets = 0;
 				}
-	#ifdef CANOPEN_BIG_ENDIAN
-				nb_targets = ((UNS8*)d->dcf++) | ((UNS8*)d->dcf++) << 8 | ((UNS8*)d->dcf++) << 16 | ((UNS8*)d->dcf++) << 24;
-	#else
-				nb_targets = *((UNS32*)dcf);
-	#endif
+				nb_targets = UNS32_LE(*((UNS32*)dcf));
 		  	}
 			
 			// condition on consise DCF string for NodeID, if big enough
 			if(d->dcf_cursor + 7 < dcfend && d->dcf_count_targets < nb_targets)
 			{
 				// pointer to the DCF string for NodeID
-	#ifdef CANOPEN_BIG_ENDIAN
-				target_Index = ((UNS8*)d->dcf_cursor++) | ((UNS8*)d->dcf_cursor++) << 8;
-				target_Subindex = ((UNS8*)d->dcf_cursor++);
-				target_Size = ((UNS8*)d->dcf_cursor++) | ((UNS8*)d->dcf_cursor++) << 8 | ((UNS8*)d->dcf_cursor++) << 16 | ((UNS8*)d->dcf_cursor++) << 24;
-	#else
-				target_Index = *((UNS16*)(d->dcf_cursor)); d->dcf_cursor += 2;
+				target_Index = UNS16_LE(*((UNS16*)(d->dcf_cursor))); d->dcf_cursor += 2;
 				target_Subindex = *((UNS8*)(d->dcf_cursor++));
-				target_Size = *((UNS32*)(d->dcf_cursor)); d->dcf_cursor += 4;
-	#endif
+				target_Size = UNS32_LE(*((UNS32*)(d->dcf_cursor))); d->dcf_cursor += 4;
 				
 					/*printf("Master : ConfigureSlaveNode %2.2x (Concise DCF)\n",nodeId);*/
 					res = writeNetworkDictCallBack(d, /*CO_Data* d*/