From: Ken Raeburn Date: Thu, 3 Dec 2009 02:17:16 +0000 (+0000) Subject: Temporarily define UINT16_TYPE and UINT32_TYPE so the load/store X-Git-Tag: krb5-1.8-alpha1~98 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e3b5edbca93ade2678436bcff9b7979d1b9f7259;p=krb5.git Temporarily define UINT16_TYPE and UINT32_TYPE so the load/store functions don't need excessive conditionals internally. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23437 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/include/k5-platform.h b/src/include/k5-platform.h index 9b02462b6..fd3ceec9c 100644 --- a/src/include/k5-platform.h +++ b/src/include/k5-platform.h @@ -713,54 +713,43 @@ load_64_le (const void *cvp) #endif } -static inline void -store_16_n (unsigned int val, void *vp) -{ #ifdef _WIN32 - unsigned __int16 n; +#define UINT16_TYPE unsigned __int16 +#define UINT32_TYPE unsigned __int32 #else - uint16_t n; +#define UINT16_TYPE uint16_t +#define UINT32_TYPE uint32_t #endif - n = val; + +static inline void +store_16_n (unsigned int val, void *vp) +{ + UINT16_TYPE n = val; memcpy(vp, &n, 2); } static inline void store_32_n (unsigned int val, void *vp) { -#ifdef _WIN32 - unsigned __int32 n; -#else - uint32_t n; -#endif - n = val; + UINT32_TYPE n = val; memcpy(vp, &n, 4); } static inline void store_64_n (UINT64_TYPE val, void *vp) { - UINT64_TYPE n; - n = val; + UINT64_TYPE n = val; memcpy(vp, &n, 8); } static inline unsigned short load_16_n (const void *p) { -#ifdef _WIN32 - unsigned __int16 n; -#else - uint16_t n; -#endif + UINT16_TYPE n; memcpy(&n, p, 2); return n; } static inline unsigned int load_32_n (const void *p) { -#ifdef _WIN32 - unsigned __int32 n; -#else - uint32_t n; -#endif + UINT32_TYPE n; memcpy(&n, p, 4); return n; } @@ -771,6 +760,8 @@ load_64_n (const void *p) memcpy(&n, p, 8); return n; } +#undef UINT16_TYPE +#undef UINT32_TYPE /* Assume for simplicity that these swaps are identical. */ static inline UINT64_TYPE