This is an automated email from Gerrit. Mathias K?ster (kes...@freenet.de) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/364
-- gerrit commit 5c84ffb81f6ec64e17b9117c5e36197ba0f9c27f Author: Mathias K <kes...@freenet.de> Date: Tue Jan 10 22:28:07 2012 +0100 optimize: replace while loop by memcpy There is no need to use a while loop here. This patch simple copy the last bytes with the system function. Change-Id: Ibda72dca449746efeba5a1af2e45c5990f9cf347 Signed-off-by: Mathias K <kes...@freenet.de> diff --git a/src/flash/nor/str7x.c b/src/flash/nor/str7x.c index 91ef77b..2ebc283 100644 --- a/src/flash/nor/str7x.c +++ b/src/flash/nor/str7x.c @@ -707,14 +707,9 @@ static int str7x_write(struct flash_bank *bank, uint8_t *buffer, if (bytes_remaining) { uint8_t last_dword[8] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - i = 0; - while (bytes_remaining > 0) - { - last_dword[i++] = *(buffer + bytes_written); - bytes_remaining--; - bytes_written++; - } + /* copy the last remaining bytes into the write buffer */ + memcpy(last_dword, buffer+bytes_written, bytes_remaining); /* command */ cmd = FLASH_DWPG; -- ------------------------------------------------------------------------------ Write once. Port to many. Get the SDK and tools to simplify cross-platform app development. Create new or port existing apps to sell to consumers worldwide. Explore the Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join http://p.sf.net/sfu/intel-appdev _______________________________________________ OpenOCD-devel mailing list OpenOCD-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openocd-devel