[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r8658 - in gnuradio/trunk: . gruel/src/include/gruel
From: |
jcorgan |
Subject: |
[Commit-gnuradio] r8658 - in gnuradio/trunk: . gruel/src/include/gruel |
Date: |
Sun, 22 Jun 2008 18:25:57 -0600 (MDT) |
Author: jcorgan
Date: 2008-06-22 18:25:56 -0600 (Sun, 22 Jun 2008)
New Revision: 8658
Modified:
gnuradio/trunk/configure.ac
gnuradio/trunk/gruel/src/include/gruel/inet.h.in
Log:
Use system byteswap implementations where available.
Modified: gnuradio/trunk/configure.ac
===================================================================
--- gnuradio/trunk/configure.ac 2008-06-23 00:19:01 UTC (rev 8657)
+++ gnuradio/trunk/configure.ac 2008-06-23 00:25:56 UTC (rev 8658)
@@ -128,7 +128,13 @@
AC_CHECK_HEADERS(sys/resource.h stdint.h sched.h signal.h sys/syscall.h)
AC_CHECK_HEADERS(netinet/in.h)
AC_CHECK_HEADERS(windows.h)
+
+dnl Allow creating autoconf independent header files for bytesex routines
+AC_CHECK_HEADER(arpa/inet.h, [GR_HAVE_ARPA_INET=1],[GR_HAVE_ARPA_INET=0])
+AC_CHECK_HEADER(netinet/in.h, [GR_HAVE_NETINET_IN=1],[GR_HAVE_NETINET_IN=0])
AC_CHECK_HEADER(byteswap.h, [GR_HAVE_BYTESWAP=1],[GR_HAVE_BYTESWAP=0])
+AC_SUBST(GR_HAVE_ARPA_INET)
+AC_SUBST(GR_HAVE_NETINET_IN)
AC_SUBST(GR_HAVE_BYTESWAP)
dnl Checks for typedefs, structures, and compiler characteristics.
Modified: gnuradio/trunk/gruel/src/include/gruel/inet.h.in
===================================================================
--- gnuradio/trunk/gruel/src/include/gruel/inet.h.in 2008-06-23 00:19:01 UTC
(rev 8657)
+++ gnuradio/trunk/gruel/src/include/gruel/inet.h.in 2008-06-23 00:25:56 UTC
(rev 8658)
@@ -19,6 +19,11 @@
#ifndef INCLUDED_INET_H
#define INCLUDED_INET_H
+#if @GR_HAVE_ARPA_INET@ /* GR_HAVE_ARPA_INET */
+#include <arpa/inet.h>
+#elif @GR_HAVE_NETINET_IN@ /* GR_HAVE_NETINET_IN */
+#include <netinet/in.h>
+#else
#include <stdint.h>
#if @GR_ARCH_BIGENDIAN@ /* GR_ARCH_BIGENDIAN */
@@ -31,19 +36,17 @@
#if @GR_HAVE_BYTESWAP@ /* GR_HAVE_BYTESWAP */
#include <byteswap.h>
#else
-#warning Using non-portable code (likely wrong other than ILP32).
-
-static inline unsigned short int
-bswap_16 (unsigned short int x)
+static inline uint16_t
+bswap_16 (uint16_t x)
{
return ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8));
}
-static inline unsigned int
-bswap_32 (unsigned int x)
+static inline uint32_t
+bswap_32 (uint32_t x)
{
- return ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) \
- | (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24));
+ return ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) \
+ | (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24));
}
#endif /* GR_HAVE_BYTESWAP */
@@ -53,6 +56,8 @@
static inline uint16_t ntohs(uint16_t x){ return bswap_16(x); }
#endif /* GR_ARCH_BIGENDIAN */
+#endif /* !(GR_HAVE_NETINET_IN || GR_HAVE_ARPA_INET) */
+
static inline uint8_t ntohx(uint8_t x){ return x; }
static inline uint16_t ntohx(uint16_t x){ return ntohs(x); }
static inline uint32_t ntohx(uint32_t x){ return ntohl(x); }
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r8658 - in gnuradio/trunk: . gruel/src/include/gruel,
jcorgan <=