diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2009-06-27 21:05:14 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2009-06-27 21:05:14 +0000 |
commit | 4e5f07abc5cdc1f076eb8713c75823fd2097d911 (patch) | |
tree | 1e640322b516eeab31c58aad886edd3932814efe /lib/util/wordaccess_gcc3_le.h | |
parent | 3ecf4ceb636585673b6eec27c1e56f85dc6d2dfe (diff) | |
download | netpbm-mirror-4e5f07abc5cdc1f076eb8713c75823fd2097d911.tar.gz netpbm-mirror-4e5f07abc5cdc1f076eb8713c75823fd2097d911.tar.xz netpbm-mirror-4e5f07abc5cdc1f076eb8713c75823fd2097d911.zip |
Release 10.47.00: rebase to trunk
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@944 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'lib/util/wordaccess_gcc3_le.h')
-rw-r--r-- | lib/util/wordaccess_gcc3_le.h | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/lib/util/wordaccess_gcc3_le.h b/lib/util/wordaccess_gcc3_le.h deleted file mode 100644 index 798566af..00000000 --- a/lib/util/wordaccess_gcc3_le.h +++ /dev/null @@ -1,56 +0,0 @@ -/*============================================================================= - - This file is the part of wordaccess.h for use under these - conditions: - - * GCC (>=3.4), GLIBC - * 32 bit Little-Endian machines (intel MPUs 80386, Pentium, etc.) - * Other non-Big-Endian machines (very rare) - -=============================================================================*/ - -typedef uint32_t wordint; -typedef unsigned char wordintBytes[sizeof(wordint)]; - -#include <sys/types.h> -#include <netinet/in.h> - -#include "pm.h" - -/* - Here we use the more widely used functions htonl and ntohl instead of - bswap_32. This makes possible the handling of weird byte ordering - (neither Big-Endian nor Little-Endian) schemes, if any. -*/ - -static __inline__ wordint -bytesToWordint(wordintBytes const bytes) { - return (wordint) ntohl(*(wordint *)bytes); -} - - - -static __inline__ void -wordintToBytes(wordintBytes * const bytesP, - wordint const wordInt) { - - *(wordint *)bytesP = htonl(wordInt); -} - - - -static __inline__ unsigned int -wordintClz(wordint const x) { - - /* Find the data type closest to 32 bits, and file off any extra. */ - - if (x == 0) - return sizeof(wordint) * 8; - else if (sizeof(int) >= 4) - return __builtin_clz((int)x << (sizeof(int) - 4) * 8); - else if (sizeof(long int) >= 4) - return __builtin_clzl((long int)x << (sizeof(long int) - 4) * 8); - else - pm_error("Long int is less than 32 bits on this machine"); -} - |