aboutsummaryrefslogtreecommitdiff
path: root/coreutils/dd.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2013-08-20 12:49:28 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2013-08-20 12:49:28 +0200
commit0ff0b320a2dbb5e0b5fa245ffd9b2648d7026843 (patch)
tree5cab931e8ad6fdaa8a6b0e3d5344f6c9d8f039f1 /coreutils/dd.c
parent1b57fe108f082167fd85a5962769a941ba871dd4 (diff)
downloadbusybox-0ff0b320a2dbb5e0b5fa245ffd9b2648d7026843.tar.gz
dd: code shrink
function old new delta dd_main 1475 1469 -6 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils/dd.c')
-rw-r--r--coreutils/dd.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/coreutils/dd.c b/coreutils/dd.c
index 9299f58bc..2838f6341 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -395,7 +395,8 @@ int dd_main(int argc UNUSED_PARAM, char **argv)
n = 0;
}
if (flags & FLAG_SWAB) {
- uint16_t *p16, *end;
+ uint16_t *p16;
+ ssize_t n2;
/* Our code allows only last read to be odd-sized */
if (prev_read_size & 1)
@@ -408,8 +409,8 @@ int dd_main(int argc UNUSED_PARAM, char **argv)
* prints "wqe".
*/
p16 = (void*) ibuf;
- end = (void*) (ibuf + (n & ~(ssize_t)1));
- while (p16 < end) {
+ n2 = (n >> 1);
+ while (--n2 >= 0) {
*p16 = bswap_16(*p16);
p16++;
}