Index: trunk/softs/tsar_boot/src/reset_utils.c
===================================================================
--- trunk/softs/tsar_boot/src/reset_utils.c	(revision 702)
+++ trunk/softs/tsar_boot/src/reset_utils.c	(revision 703)
@@ -120,8 +120,6 @@
     unsigned int *dst = _dst;
     const unsigned int *src = _src;
-    if ( !((unsigned int)dst & 3) && !((unsigned int)src & 3) )
-    {
-        while (n > 3) 
-        {
+    if (!((unsigned int)dst & 3) && !((unsigned int)src & 3)) {
+        while (n > 3) {
             *dst++ = *src++;
             n -= 4;
@@ -131,6 +129,5 @@
     unsigned char *cdst = (unsigned char*) dst;
     unsigned char *csrc = (unsigned char*) src;
-    while (n--) 
-    {
+    while (n--) {
         *cdst++ = *csrc++;
     }
@@ -153,30 +150,30 @@
 
     unsigned char val = (unsigned char) c;
+
+    /*
+     * Set not word aligned bytes at start of destination buffer
+     */
+    unsigned char* cdst = (unsigned char*) _dst;
+    while (((addr_t)cdst & 3) && len--) {
+        *cdst++ = val;
+    }
+
+    /*
+     * Set 4 bytes words on destination buffer
+     */
     unsigned int word = (val << 24) | (val << 16) | (val << 8 ) | val;
-
-    /*
-     * Write 4 bytes when destination buffer is aligned to 4 bytes
-     * and size is greater or equal to 4 
-     */
-    unsigned int *dst = _dst;
-    if ( !((unsigned int)dst & 3) )
-    {
-        while (len > 3) 
-        {
-            *dst++ = word;
-            len -= 4;
-        }
-    }
-
-    /*
-     * Write 1 byte when destination buffer is not aligned to 4 bytes
-     * or size is smaller than 4 
-     */
-    unsigned char* cdst = (unsigned char*) _dst;
-    while(len--)
-    {
-        *cdst++ = (unsigned char) c;
-    }
-
+    addr_t *wdst = (addr_t*)cdst;
+    while (len > 3) {
+        *wdst++ = word;
+        len -= 4;
+    }
+
+    /*
+     * Set not word aligned bytes at end of destination buffer
+     */
+    cdst = (unsigned char*) wdst;
+    while(len--) {
+        *cdst++ = val;
+    }
     return _dst;
 }
