aboutsummaryrefslogtreecommitdiffstats
path: root/libfat
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-11-01 15:34:09 -0700
committerH. Peter Anvin <hpa@zytor.com>2007-11-01 15:35:06 -0700
commit0791bf3c88f8f639e367bc2edd5f181c41e7e42b (patch)
treeea472051d4ec225ad4d600bf90c159f1778fe5a5 /libfat
parente63b87680dda2a538b677110489822dc1d1e77ac (diff)
downloadsyslinux-elf-0791bf3c88f8f639e367bc2edd5f181c41e7e42b.tar.gz
syslinux-elf-0791bf3c88f8f639e367bc2edd5f181c41e7e42b.tar.xz
syslinux-elf-0791bf3c88f8f639e367bc2edd5f181c41e7e42b.zip
Try to fix libfat/ulint.h for non-x86 platforms
libfat/ulint.h doesn't work as expected because of array devolution to pointers. Try to fix.
Diffstat (limited to 'libfat')
-rw-r--r--libfat/ulint.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/libfat/ulint.h b/libfat/ulint.h
index 76c6bdbd..79eeaf41 100644
--- a/libfat/ulint.h
+++ b/libfat/ulint.h
@@ -74,25 +74,31 @@ write32(le32_t *_p, uint32_t _v)
/* Generic, mostly portable versions */
static inline unsigned short
-read16(le16_t *_p)
+read16(le16_t *_pp)
{
+ uint8_t *_p = *_pp;
uint16_t _v;
- _v = p[0];
- _v |= p[1] << 8;
+ _v = _p[0];
+ _v |= _p[1] << 8;
return _v;
}
static inline void
-write16(le16_t *_p, uint16_t _v)
+write16(le16_t *_pp, uint16_t _v)
{
+ uint8_t *_p = *_pp;
+
_p[0] = _v & 0xFF;
_p[1] = (_v >> 8) & 0xFF;
}
static inline unsigned int
-read32(le32_t *_p)
+read32(le32_t *_pp)
{
+ uint8_t *_p = *_pp;
+ uint32_t _v;
+
_v = _p[0];
_v |= _p[1] << 8;
_v |= _p[2] << 16;
@@ -101,8 +107,10 @@ read32(le32_t *_p)
}
static inline void
-write32(le32_t *_p, uint32_t _v)
+write32(le32_t *_pp, uint32_t _v)
{
+ uint8_t *_p = *_pp;
+
_p[0] = _v & 0xFF;
_p[1] = (_v >> 8) & 0xFF;
_p[2] = (_v >> 16) & 0xFF;