summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Bernardy <jeanphilippe.bernardy@gmail.com>2005-02-27 20:44:26 +0000
committerJean-Philippe Bernardy <jeanphilippe.bernardy@gmail.com>2005-02-27 20:44:26 +0000
commita83214d16f58ce22f0b2b1ea43de857f8ecb7dde (patch)
tree51892d6e94a2c3073acc0ff5b2b506ee738d1ea6
parent3d0ae46ac6b40307bd654c618708309470d47dc6 (diff)
downloadrockbox-a83214d16f58ce22f0b2b1ea43de857f8ecb7dde.zip
rockbox-a83214d16f58ce22f0b2b1ea43de857f8ecb7dde.tar.gz
rockbox-a83214d16f58ce22f0b2b1ea43de857f8ecb7dde.tar.bz2
rockbox-a83214d16f58ce22f0b2b1ea43de857f8ecb7dde.tar.xz
couple of fixes for 16 bits archs
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6073 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/common/disk.c2
-rw-r--r--firmware/drivers/fat.c6
2 files changed, 5 insertions, 3 deletions
diff --git a/firmware/common/disk.c b/firmware/common/disk.c
index fd6de55..f4d153c 100644
--- a/firmware/common/disk.c
+++ b/firmware/common/disk.c
@@ -42,7 +42,7 @@
*/
#define BYTES2INT32(array,pos) \
- ((long)array[pos] | (long)(array[pos+1] << 8 ) | \
+ ((long)array[pos] | ((long)array[pos+1] << 8 ) | \
((long)array[pos+2] << 16 ) | ((long)array[pos+3] << 24 ))
static struct partinfo part[8]; /* space for 4 partitions on 2 drives */
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c
index 465adec..cf26654 100644
--- a/firmware/drivers/fat.c
+++ b/firmware/drivers/fat.c
@@ -1588,8 +1588,10 @@ static int parse_direntry(struct fat_direntry *de, const unsigned char *buf)
de->wrtdate = BYTES2INT16(buf,FATDIR_WRTDATE);
de->wrttime = BYTES2INT16(buf,FATDIR_WRTTIME);
de->filesize = BYTES2INT32(buf,FATDIR_FILESIZE);
- de->firstcluster = ((long)BYTES2INT16(buf,FATDIR_FSTCLUSLO)) |
- ((long)BYTES2INT16(buf,FATDIR_FSTCLUSHI) << 16);
+ de->firstcluster = ((long)(unsigned)BYTES2INT16(buf,FATDIR_FSTCLUSLO)) |
+ ((long)(unsigned)BYTES2INT16(buf,FATDIR_FSTCLUSHI) << 16);
+ /* The double cast is to prevent a sign-extension to be done on CalmRISC16.
+ (the result of the shift is always considered signed) */
/* fix the name */
for (i=0; (i<8) && (buf[FATDIR_NAME+i] != ' '); i++)