diff options
author | Ken Raeburn <raeburn@mit.edu> | 2009-12-03 02:17:16 +0000 |
---|---|---|
committer | Ken Raeburn <raeburn@mit.edu> | 2009-12-03 02:17:16 +0000 |
commit | e3b5edbca93ade2678436bcff9b7979d1b9f7259 (patch) | |
tree | 9107f8bcae621dcb6046e8fcd8daa2ba1328360d /src | |
parent | 4d79de8b490a25745ac88830682999df5e46e076 (diff) | |
download | krb5-e3b5edbca93ade2678436bcff9b7979d1b9f7259.zip krb5-e3b5edbca93ade2678436bcff9b7979d1b9f7259.tar.gz krb5-e3b5edbca93ade2678436bcff9b7979d1b9f7259.tar.bz2 |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/include/k5-platform.h | 39 |
1 files changed, 15 insertions, 24 deletions
diff --git a/src/include/k5-platform.h b/src/include/k5-platform.h index 9b02462..fd3ceec 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 |