ref: 61492029a54f3caa60c9693ded94b0de09470e1a
parent: 65e823da0f96216cb75e8680fec8d29ae60394fc
author: David Turner <[email protected]>
date: Tue May 2 06:50:18 EDT 2000
added macros to read little endian words from a byte stream (e.g. NEXT_ShortLE(buffer))
--- a/src/base/ftstream.h
+++ b/src/base/ftstream.h
@@ -75,6 +75,11 @@
#define FT_FRAME_BYTE(s,f) FT_FRAME_FIELD( ft_frame_byte, s, f )
#define FT_FRAME_CHAR(s,f) FT_FRAME_FIELD( ft_frame_schar, s, f )
+#define FT_FRAME_LONG_LE(s,f) FT_FRAME_FIELD( ft_frame_long_le, s, f )
+#define FT_FRAME_ULONG_LE(s,f) FT_FRAME_FIELD( ft_frame_ulong_le, s, f )
+#define FT_FRAME_SHORT_LE(s,f) FT_FRAME_FIELD( ft_frame_short_le, s, f )
+#define FT_FRAME_USHORT_LE(s,f) FT_FRAME_FIELD( ft_frame_ushort_le, s, f )
+
/*************************************************************************/
/* */
/* integer extraction macros - the `buffer' parameter must ALWAYS be of */
@@ -104,6 +109,28 @@
#define NEXT_ULong(buffer) ((unsigned long)NEXT_Long(buffer))
+
+#define NEXT_ShortLE(buffer) ( buffer += 2, \
+ ( (short)((signed char)buffer[-1] << 8) | \
+ (unsigned char)buffer[-2] ) )
+
+#define NEXT_UShortLE(buffer) ((unsigned short)NEXT_ShortLE(buffer))
+
+#define NEXT_OffsetLE(buffer) ( buffer += 3, \
+ ( ((long)(signed char)buffer[-1] << 16) | \
+ ((long)(unsigned char)buffer[-2] << 8) | \
+ (long)(unsigned char)buffer[-3] ) )
+
+#define NEXT_UOffsetLE(buffer) ((unsigned long)NEXT_OffsetLE(buffer))
+
+
+#define NEXT_LongLE(buffer) ( buffer += 4, \
+ ( ((long)(signed char)buffer[-1] << 24) | \
+ ((long)(unsigned char)buffer[-2] << 16) | \
+ ((long)(unsigned char)buffer[-3] << 8) | \
+ (long)(unsigned char)buffer[-4] ) )
+
+#define NEXT_ULongLE(buffer) ((unsigned long)NEXT_LongLE(buffer))
/*************************************************************************/
/* */