Use GLib's macros for converting from host byte order to little-endian.
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 29 Jul 2003 20:41:19 +0000 (20:41 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 29 Jul 2003 20:41:19 +0000 (20:41 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@8096 f5534014-38df-0310-8fa8-9805f1628bb7

wiretap/wtap-int.h

index 51e0656c787e49f169fa8d22b717236dd01f5f13..bdf788b2d0bac7b19347d00f7597bf0d686c45a0 100644 (file)
@@ -1,6 +1,6 @@
 /* wtap-int.h
  *
- * $Id: wtap-int.h,v 1.36 2003/07/29 19:42:01 guy Exp $
+ * $Id: wtap-int.h,v 1.37 2003/07/29 20:41:19 guy Exp $
  *
  * Wiretap Library
  * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -218,26 +218,12 @@ struct wtap_dumper {
          (((x)&0x00FF)<<8))
 
 /* Turn host-byte-order values into little-endian values. */
-#ifdef WORDS_BIGENDIAN
-#define htoles(s) ((guint16)                       \
-                    ((guint16)((s) & 0x00FF)<<8|  \
-                     (guint16)((s) & 0xFF00)>>8))
-
-#define htolel(l) ((guint32)((l) & 0x000000FF)<<24|  \
-                   (guint32)((l) & 0x0000FF00)<<8|  \
-                   (guint32)((l) & 0x00FF0000)>>8|   \
-                   (guint32)((l) & 0xFF000000)>>24)
-
+#define htoles(ll) GUINT16_TO_LE(ll)
+#define htolel(ll) GUINT32_TO_LE(ll)
 #ifdef G_HAVE_GINT64
 #define htolell(ll) GUINT64_TO_LE(ll)
 #endif /* G_HAVE_GINT64 */
 
-#else /* WORDS_BIGENDIAN */
-#define htoles(s)      (s)
-#define htolel(l)      (l)
-#define htolell(ll)    (ll)
-#endif /* WORDS_BIGENDIAN */
-
 /* Pointer versions of ntohs and ntohl.  Given a pointer to a member of a
  * byte array, returns the value of the two or four bytes at the pointer.
  * The pletoh[sl] versions return the little-endian representation.