Minor changes to guarantee that UNS8 cast is well done
authorluis
Mon, 04 Feb 2008 11:07:32 +0100
changeset 379 193558036df4
parent 378 d2abf6c8c27b
child 380 fe47568b8281
Minor changes to guarantee that UNS8 cast is well done
src/pdo.c
--- a/src/pdo.c	Fri Feb 01 18:06:55 2008 +0100
+++ b/src/pdo.c	Mon Feb 04 11:07:32 2008 +0100
@@ -68,7 +68,7 @@
 		/* pointer fo the var which holds the mapping parameter of an mapping entry  */
 		UNS32* pMappingParameter = (UNS32*) TPDO_map->pSubindex[prp_j + 1].pObject;
 		UNS16 index = (UNS16)((*pMappingParameter) >> 16);
-		UNS8 Size = (UNS8)(*pMappingParameter); /* Size in bits */
+		UNS8 Size = (UNS8)(*pMappingParameter) & (UNS32)0x000000FF); /* Size in bits */
 		
 		/* get variable only if Size != 0 and Size is lower than remaining bits in the PDO */
 		if(Size && ((offset + Size) <= 64)) {
@@ -229,7 +229,7 @@
                /* and the lower 8 bits contains the size of the mapped
                  variable. */
 
-               Size = (UNS8)(*pMappingParameter);
+               Size = (UNS8)(*pMappingParameter) & (UNS32)0x000000FF);
 					
 					/* set variable only if Size != 0 and Size is lower than remaining bits in the PDO */
                if(Size && ((offset + Size) <= (m->len << 3))) {