mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexander Kuleshov <kuleshovmail@gmail.com>
To: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: linux-kernel@vger.kernel.org,
	Alexander Kuleshov <kuleshovmail@gmail.com>
Subject: [PATCH] fs/fat: calculate checksum in a loop instead of directly calculating
Date: Thu, 19 Feb 2015 00:48:20 +0600	[thread overview]
Message-ID: <1424285300-14431-1-git-send-email-kuleshovmail@gmail.com> (raw)

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


             reply	other threads:[~2015-02-18 18:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-18 18:48 Alexander Kuleshov [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1424285300-14431-1-git-send-email-kuleshovmail@gmail.com \
    --to=kuleshovmail@gmail.com \
    --cc=hirofumi@mail.parknet.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®