aboutsummaryrefslogtreecommitdiff
path: root/lib/warnless.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/warnless.c')
-rw-r--r--lib/warnless.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/warnless.c b/lib/warnless.c
index 5fbc23400..6b77eea22 100644
--- a/lib/warnless.c
+++ b/lib/warnless.c
@@ -185,6 +185,7 @@ unsigned long curlx_uztoul(size_t uznum)
# pragma warning(disable:810) /* conversion may lose significant bits */
#endif
+ DEBUGASSERT(uznum <= (size_t) CURL_MASK_ULONG);
return (unsigned long)(uznum & (size_t) CURL_MASK_ULONG);
#ifdef __INTEL_COMPILER
@@ -193,6 +194,25 @@ unsigned long curlx_uztoul(size_t uznum)
}
/*
+** unsigned size_t to unsigned int
+*/
+
+unsigned int curlx_uztoui(size_t uznum)
+{
+#ifdef __INTEL_COMPILER
+# pragma warning(push)
+# pragma warning(disable:810) /* conversion may lose significant bits */
+#endif
+
+ DEBUGASSERT(uznum <= (size_t) CURL_MASK_UINT);
+ return (unsigned int)(uznum & (size_t) CURL_MASK_UINT);
+
+#ifdef __INTEL_COMPILER
+# pragma warning(pop)
+#endif
+}
+
+/*
** signed long to signed int
*/