aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libfat/ulint.h84
1 files changed, 37 insertions, 47 deletions
diff --git a/libfat/ulint.h b/libfat/ulint.h
index 78712627..c2fadb72 100644
--- a/libfat/ulint.h
+++ b/libfat/ulint.h
@@ -29,92 +29,82 @@ typedef uint8_t le32_t[4]; /* 32-bit dword */
/* Read/write these quantities */
-static inline unsigned char
-read8(le8_t *_p)
+static inline unsigned char read8(le8_t * _p)
{
- return *_p;
+ return *_p;
}
-static inline void
-write8(le8_t *_p, uint8_t _v)
+static inline void write8(le8_t * _p, uint8_t _v)
{
- *_p = _v;
+ *_p = _v;
}
#if defined(__i386__) || defined(__x86_64__)
/* Littleendian architectures which support unaligned memory accesses */
-static inline unsigned short
-read16(le16_t *_p)
+static inline unsigned short read16(le16_t * _p)
{
- return *((const uint16_t *)_p);
+ return *((const uint16_t *)_p);
}
-static inline void
-write16(le16_t *_p, unsigned short _v)
+static inline void write16(le16_t * _p, unsigned short _v)
{
- *((uint16_t *)_p) = _v;
+ *((uint16_t *) _p) = _v;
}
-static inline unsigned int
-read32(le32_t *_p)
+static inline unsigned int read32(le32_t * _p)
{
- return *((const uint32_t *)_p);
+ return *((const uint32_t *)_p);
}
-static inline void
-write32(le32_t *_p, uint32_t _v)
+static inline void write32(le32_t * _p, uint32_t _v)
{
- *((uint32_t *)_p) = _v;
+ *((uint32_t *) _p) = _v;
}
#else
/* Generic, mostly portable versions */
-static inline unsigned short
-read16(le16_t *_pp)
+static inline unsigned short read16(le16_t * _pp)
{
- uint8_t *_p = *_pp;
- uint16_t _v;
+ uint8_t *_p = *_pp;
+ uint16_t _v;
- _v = _p[0];
- _v |= _p[1] << 8;
- return _v;
+ _v = _p[0];
+ _v |= _p[1] << 8;
+ return _v;
}
-static inline void
-write16(le16_t *_pp, uint16_t _v)
+static inline void write16(le16_t * _pp, uint16_t _v)
{
- uint8_t *_p = *_pp;
+ uint8_t *_p = *_pp;
- _p[0] = _v & 0xFF;
- _p[1] = (_v >> 8) & 0xFF;
+ _p[0] = _v & 0xFF;
+ _p[1] = (_v >> 8) & 0xFF;
}
-static inline unsigned int
-read32(le32_t *_pp)
+static inline unsigned int read32(le32_t * _pp)
{
- uint8_t *_p = *_pp;
- uint32_t _v;
-
- _v = _p[0];
- _v |= _p[1] << 8;
- _v |= _p[2] << 16;
- _v |= _p[3] << 24;
- return _v;
+ uint8_t *_p = *_pp;
+ uint32_t _v;
+
+ _v = _p[0];
+ _v |= _p[1] << 8;
+ _v |= _p[2] << 16;
+ _v |= _p[3] << 24;
+ return _v;
}
-static inline void
-write32(le32_t *_pp, uint32_t _v)
+static inline void write32(le32_t * _pp, uint32_t _v)
{
- uint8_t *_p = *_pp;
+ uint8_t *_p = *_pp;
- _p[0] = _v & 0xFF;
- _p[1] = (_v >> 8) & 0xFF;
- _p[2] = (_v >> 16) & 0xFF;
- _p[3] = (_v >> 24) & 0xFF;
+ _p[0] = _v & 0xFF;
+ _p[1] = (_v >> 8) & 0xFF;
+ _p[2] = (_v >> 16) & 0xFF;
+ _p[3] = (_v >> 24) & 0xFF;
}
#endif