Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753990AbbBRStI (ORCPT ); Wed, 18 Feb 2015 13:49:08 -0500 Received: from mail-la0-f43.google.com ([209.85.215.43]:40627 "EHLO mail-la0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751833AbbBRStG (ORCPT ); Wed, 18 Feb 2015 13:49:06 -0500 From: Alexander Kuleshov To: OGAWA Hirofumi Cc: linux-kernel@vger.kernel.org, Alexander Kuleshov Subject: [PATCH] fs/fat: calculate checksum in a loop instead of directly calculating Date: Thu, 19 Feb 2015 00:48:20 +0600 Message-Id: <1424285300-14431-1-git-send-email-kuleshovmail@gmail.com> X-Mailer: git-send-email 2.3.0.80.g18d0fec Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1116 Lines: 35 Signed-off-by: Alexander Kuleshov --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/