public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fs/fat: calculate checksum in a loop instead of directly calculating
@ 2015-02-18 18:48 Alexander Kuleshov
  2015-02-18 19:25 ` OGAWA Hirofumi
  0 siblings, 1 reply; 7+ messages in thread
From: Alexander Kuleshov @ 2015-02-18 18:48 UTC (permalink / raw)
  To: OGAWA Hirofumi; +Cc: linux-kernel, Alexander Kuleshov

Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
---
 fs/fat/fat.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/fat/fat.h b/fs/fat/fat.h
index 64e295e..1a5080b 100644
--- a/fs/fat/fat.h
+++ b/fs/fat/fat.h
@@ -207,12 +207,12 @@ static inline void fat_save_attrs(struct inode *inode, u8 attrs)
 
 static inline unsigned char fat_checksum(const __u8 *name)
 {
+	u8 i;
 	unsigned char s = name[0];
-	s = (s<<7) + (s>>1) + name[1];	s = (s<<7) + (s>>1) + name[2];
-	s = (s<<7) + (s>>1) + name[3];	s = (s<<7) + (s>>1) + name[4];
-	s = (s<<7) + (s>>1) + name[5];	s = (s<<7) + (s>>1) + name[6];
-	s = (s<<7) + (s>>1) + name[7];	s = (s<<7) + (s>>1) + name[8];
-	s = (s<<7) + (s>>1) + name[9];	s = (s<<7) + (s>>1) + name[10];
+
+	for (i = 1; i < 11; i++)
+		s = (s << 7) + (s >> 1) + name[i];
+
 	return s;
 }
 
-- 
2.3.0.80.g18d0fec


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-02-24 19:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-18 18:48 [PATCH] fs/fat: calculate checksum in a loop instead of directly calculating Alexander Kuleshov
2015-02-18 19:25 ` OGAWA Hirofumi
2015-02-18 19:46   ` Alexander Kuleshov
2015-02-18 20:32     ` OGAWA Hirofumi
2015-02-23 20:40       ` Heinrich Schuchardt
2015-02-24  2:42         ` OGAWA Hirofumi
2015-02-24 19:22           ` Heinrich Schuchardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox