From: Bart O. <bar...@us...> - 2004-04-24 15:53:30
|
Update of /cvsroot/freedos/kernel/kernel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27587 Modified Files: fattab.c Log Message: Some of Arkady's fattab optimizations -- the others only increase the kernel size for Watcom. Index: fattab.c =================================================================== RCS file: /cvsroot/freedos/kernel/kernel/fattab.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- fattab.c 7 Feb 2004 18:04:49 -0000 1.21 +++ fattab.c 24 Apr 2004 15:53:21 -0000 1.22 @@ -145,9 +145,9 @@ /* */ /* 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 @@ /* 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 @@ /* 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)) |