Stop abusing "idx". The OW optimizer likes this better, too.

git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@909 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2004-04-30 16:49:34 +00:00
parent 00e1527fc5
commit 9cbede2ec9
1 changed files with 14 additions and 14 deletions

View File

@ -184,7 +184,7 @@ CLUSTER link_fat(struct dpb FAR * dpbp, CLUSTER Cluster1,
{ {
REG UBYTE FAR *fbp0, FAR * fbp1; REG UBYTE FAR *fbp0, FAR * fbp1;
struct buffer FAR * bp1; struct buffer FAR * bp1;
unsigned cluster; unsigned cluster, cluster2;
/* form an index so that we can read the block as a */ /* form an index so that we can read the block as a */
/* byte array */ /* byte array */
@ -212,38 +212,38 @@ CLUSTER link_fat(struct dpb FAR * dpbp, CLUSTER Cluster1,
fbp1 = &bp1->b_buffer[0]; fbp1 = &bp1->b_buffer[0];
} }
idx = *fbp0 | (*fbp1 << 8); cluster = *fbp0 | (*fbp1 << 8);
if (Cluster2 == READ_CLUSTER) if ((unsigned)Cluster2 == READ_CLUSTER)
{ {
/* Now to unpack the contents of the FAT entry. Odd and */ /* Now to unpack the contents of the FAT entry. Odd and */
/* even bytes are packed differently. */ /* even bytes are packed differently. */
if (Cluster1 & 0x01) if (Cluster1 & 0x01)
idx >>= 4; cluster >>= 4;
idx &= 0x0fff; cluster &= 0x0fff;
if (idx >= MASK12) if (cluster >= MASK12)
return LONG_LAST_CLUSTER; return LONG_LAST_CLUSTER;
if (idx == BAD12) if (cluster == BAD12)
return LONG_BAD; return LONG_BAD;
return idx; return cluster;
} }
/* Cluster2 may be set to LONG_LAST_CLUSTER == 0x0FFFFFFFUL or 0xFFFF */ /* Cluster2 may be set to LONG_LAST_CLUSTER == 0x0FFFFFFFUL or 0xFFFF */
/* -- please don't remove this mask! */ /* -- please don't remove this mask! */
cluster = (unsigned)Cluster2 & 0x0fff; cluster2 = (unsigned)Cluster2 & 0x0fff;
/* Now pack the value in */ /* Now pack the value in */
if ((unsigned)Cluster1 & 0x01) if ((unsigned)Cluster1 & 0x01)
{ {
idx &= 0x000f; cluster &= 0x000f;
cluster <<= 4; cluster2 <<= 4;
} }
else else
{ {
idx &= 0xf000; cluster &= 0xf000;
} }
cluster |= idx; cluster |= cluster2;
*fbp0 = (UBYTE)cluster; *fbp0 = (UBYTE)cluster;
*fbp1 = (UBYTE)(cluster >> 8); *fbp1 = (UBYTE)(cluster >> 8);
} }
@ -251,7 +251,7 @@ CLUSTER link_fat(struct dpb FAR * dpbp, CLUSTER Cluster1,
{ {
/* form an index so that we can read the block as a */ /* form an index so that we can read the block as a */
/* byte array */ /* byte array */
if (Cluster2 == READ_CLUSTER) if ((unsigned)Cluster2 == READ_CLUSTER)
{ {
/* and get the cluster number */ /* and get the cluster number */
UWORD res = fgetword(&bp->b_buffer[idx * 2]); UWORD res = fgetword(&bp->b_buffer[idx * 2]);