Changeset 703 for trunk/softs/tsar_boot/src/reset_utils.c
- Timestamp:
- May 26, 2014, 12:06:18 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/softs/tsar_boot/src/reset_utils.c
r701 r703 120 120 unsigned int *dst = _dst; 121 121 const unsigned int *src = _src; 122 if ( !((unsigned int)dst & 3) && !((unsigned int)src & 3) ) 123 { 124 while (n > 3) 125 { 122 if (!((unsigned int)dst & 3) && !((unsigned int)src & 3)) { 123 while (n > 3) { 126 124 *dst++ = *src++; 127 125 n -= 4; … … 131 129 unsigned char *cdst = (unsigned char*) dst; 132 130 unsigned char *csrc = (unsigned char*) src; 133 while (n--) 134 { 131 while (n--) { 135 132 *cdst++ = *csrc++; 136 133 } … … 153 150 154 151 unsigned char val = (unsigned char) c; 152 153 /* 154 * Set not word aligned bytes at start of destination buffer 155 */ 156 unsigned char* cdst = (unsigned char*) _dst; 157 while (((addr_t)cdst & 3) && len--) { 158 *cdst++ = val; 159 } 160 161 /* 162 * Set 4 bytes words on destination buffer 163 */ 155 164 unsigned int word = (val << 24) | (val << 16) | (val << 8 ) | val; 156 157 /* 158 * Write 4 bytes when destination buffer is aligned to 4 bytes 159 * and size is greater or equal to 4 160 */ 161 unsigned int *dst = _dst; 162 if ( !((unsigned int)dst & 3) ) 163 { 164 while (len > 3) 165 { 166 *dst++ = word; 167 len -= 4; 168 } 169 } 170 171 /* 172 * Write 1 byte when destination buffer is not aligned to 4 bytes 173 * or size is smaller than 4 174 */ 175 unsigned char* cdst = (unsigned char*) _dst; 176 while(len--) 177 { 178 *cdst++ = (unsigned char) c; 179 } 180 165 addr_t *wdst = (addr_t*)cdst; 166 while (len > 3) { 167 *wdst++ = word; 168 len -= 4; 169 } 170 171 /* 172 * Set not word aligned bytes at end of destination buffer 173 */ 174 cdst = (unsigned char*) wdst; 175 while(len--) { 176 *cdst++ = val; 177 } 181 178 return _dst; 182 179 }
Note: See TracChangeset
for help on using the changeset viewer.