Skip to content

Commit 32e574f

Browse files
committed
Use shift to increment buf pointer
Use left shift 9 for multiplication by 512. Signed-off-by: Damien Le Moal <[email protected]>
1 parent 9655681 commit 32e574f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/zbc.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -560,10 +560,10 @@ ssize_t zbc_pread(struct zbc_device *dev, void *buf,
560560
return ret ? ret : -EIO;
561561
}
562562

563-
buf += ret * 512;
563+
buf += ret << 9;
564564
offset += ret;
565-
count -=ret;
566-
rd_count +=ret;
565+
count -= ret;
566+
rd_count += ret;
567567

568568
}
569569

@@ -616,10 +616,10 @@ ssize_t zbc_pwrite(struct zbc_device *dev, const void *buf,
616616
return ret ? ret : -EIO;
617617
}
618618

619-
buf += ret * 512;
619+
buf += ret << 9;
620620
offset += ret;
621-
count -=ret;
622-
wr_count +=ret;
621+
count -= ret;
622+
wr_count += ret;
623623

624624
}
625625

0 commit comments

Comments
 (0)