From 490a27b8575dc44e0ef5b842506eee5ace3d2848 Mon Sep 17 00:00:00 2001 From: Bart Oldeman Date: Sat, 24 Apr 2004 15:53:21 +0000 Subject: [PATCH] Some of Arkady's fattab optimizations -- the others only increase the kernel size for Watcom. git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@898 6ac86273-5f31-0410-b378-82cca8765d1b --- kernel/fattab.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/kernel/fattab.c b/kernel/fattab.c index 66698d4..327b37b 100644 --- a/kernel/fattab.c +++ b/kernel/fattab.c @@ -145,9 +145,9 @@ void write_fsinfo(struct dpb FAR * dpbp) /* */ /* The FAT file system is difficult to trace through FAT table. */ /* There are two kinds of FAT's, 12 bit and 16 bit. The 16 bit */ -/* FAT is the easiest, since it is noting more than a series of */ -/* UWORD's. The 12 bit FAT is difficult, because it packs 3 FAT */ -/* entries into two BYTE's. The are packed as follows: */ +/* FAT is the easiest, since it is nothing more than a series */ +/* of UWORD's. The 12 bit FAT is difficult, because it packs 3 */ +/* FAT entries into two BYTE's. These are packed as follows: */ /* */ /* 0x0003 0x0004 0x0005 0x0006 0x0007 0x0008 0x0009 ... */ /* */ @@ -177,9 +177,8 @@ unsigned link_fat(struct dpb FAR * dpbp, CLUSTER Cluster1, /* form an index so that we can read the block as a */ /* byte array */ - idx = (unsigned) ((((unsigned)Cluster1 << 1) + (unsigned)Cluster1) >> 1) - % dpbp->dpb_secsize; - + idx = (((unsigned)Cluster1 << 1) + (unsigned)Cluster1) % dpbp->dpb_secsize; + /* Test to see if the cluster straddles the block. If */ /* it does, get the next block and use both to form the */ /* the FAT word. Otherwise, just point to the next */ @@ -201,13 +200,13 @@ unsigned link_fat(struct dpb FAR * dpbp, CLUSTER Cluster1, /* Now pack the value in */ if ((unsigned)Cluster1 & 0x01) { - *fbp0 = (*fbp0 & 0x0f) | (((UBYTE)Cluster2 & 0x0f) << 4); + *fbp0 = (*fbp0 & 0x0f) | (UBYTE)((UBYTE)Cluster2 << 4); *fbp1 = (UBYTE)((unsigned)Cluster2 >> 4); } else { *fbp0 = (UBYTE)Cluster2; - *fbp1 = (*fbp1 & 0xf0) | ((UBYTE)((unsigned)Cluster2 >> 8) & 0x0f); + *fbp1 = (*fbp1 & 0xf0) | (UBYTE)((unsigned)Cluster2 >> 8); } } else if (ISFAT16(dpbp))