Skip to content

Commit

Permalink
rutil: fix Data for big endian builds
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.resiprocate.org/rep/resiprocate/main@10295 ddefafc4-47db-0310-ae44-fa13212b10f2
  • Loading branch information
dpocock committed Jul 19, 2013
1 parent b6fbe37 commit 4a445fe
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions rutil/Data.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1976,6 +1976,19 @@ Data::rawCaseInsensitiveHash(const unsigned char* c, size_t size)
return ntohl((u_long)st);
}

#if defined(RESIP_BIG_ENDIAN) || (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__))

#if !defined (get16bits)
#define get16bits(d) ((((UInt32)(((const UInt8 *)(d))[0])) << 8)\
+(UInt32)(((const UInt8 *)(d))[1]) )
#endif

#if !defined (get32bits)
#define get32bits(d) ((get16bits(d) << 16) + get16bits(d+2))
#endif

#else // little endian:

#undef get16bits
#if (defined(__GNUC__) && defined(__i386__)) || defined(__WATCOMC__) \
|| defined(_MSC_VER) || defined (__BORLANDC__) || defined (__TURBOC__)
Expand All @@ -1996,6 +2009,7 @@ Data::rawCaseInsensitiveHash(const unsigned char* c, size_t size)
#if !defined (get32bits)
#define get32bits(d) ((get16bits(d+2) << 16) + get16bits(d))
#endif
#endif

// This is intended to be a faster case-insensitive hash function that works
// well when the buffer is a RFC 3261 token.
Expand Down

0 comments on commit 4a445fe

Please sign in to comment.