svn rev #23437: trunk/src/include/
raeburn@MIT.EDU
raeburn at MIT.EDU
Wed Dec 2 21:17:17 EST 2009
http://src.mit.edu/fisheye/changelog/krb5/?cs=23437
Commit By: raeburn
Log Message:
Temporarily define UINT16_TYPE and UINT32_TYPE so the load/store
functions don't need excessive conditionals internally.
Changed Files:
U trunk/src/include/k5-platform.h
Modified: trunk/src/include/k5-platform.h
===================================================================
--- trunk/src/include/k5-platform.h 2009-12-02 23:34:05 UTC (rev 23436)
+++ trunk/src/include/k5-platform.h 2009-12-03 02:17:16 UTC (rev 23437)
@@ -713,54 +713,43 @@
#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 @@
memcpy(&n, p, 8);
return n;
}
+#undef UINT16_TYPE
+#undef UINT32_TYPE
/* Assume for simplicity that these swaps are identical. */
static inline UINT64_TYPE
More information about the cvs-krb5
mailing list