From bb7f10fafca307b5c1787bee44e710d5d1eae95e Mon Sep 17 00:00:00 2001 From: Bart Oldeman Date: Mon, 26 Apr 2004 21:23:26 +0000 Subject: [PATCH] Reverted bad optimization -- (unsigned)Cluster2 may have the high 4 bits set with LONG_LAST_CLUSTER. git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@902 6ac86273-5f31-0410-b378-82cca8765d1b --- kernel/fattab.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/fattab.c b/kernel/fattab.c index 8e00e0f..f2cc0cd 100644 --- a/kernel/fattab.c +++ b/kernel/fattab.c @@ -206,7 +206,9 @@ unsigned link_fat(struct dpb FAR * dpbp, CLUSTER Cluster1, else { *fbp0 = (UBYTE)Cluster2; - *fbp1 = (*fbp1 & 0xf0) | (UBYTE)((unsigned)Cluster2 >> 8); + /* Cluster2 may be set to LONG_LAST_CLUSTER == 0x0FFFFFFFUL or 0xFFFF */ + /* -- please don't optimize to (UBYTE)((unsigned)Cluster2 >> 8)! */ + *fbp1 = (*fbp1 & 0xf0) | ((UBYTE)((unsigned)Cluster2 >> 8) & 0x0f); } } else if (ISFAT16(dpbp))