tests: change from curlx_ultous to util_ultous

Since the former function is getting removed from the lib.

Closes #16319
This commit is contained in:
Daniel Stenberg 2025-02-13 14:50:47 +01:00
parent b696fc129b
commit 2e9773b76a
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
8 changed files with 32 additions and 9 deletions

View file

@ -899,3 +899,24 @@ int bind_unix_socket(curl_socket_t sock, const char *unix_socket,
return rc;
}
#endif
/*
** unsigned long to unsigned short
*/
#define CURL_MASK_USHORT ((unsigned short)~0)
#define CURL_MASK_SSHORT (CURL_MASK_USHORT >> 1)
unsigned short util_ultous(unsigned long ulnum)
{
#ifdef __INTEL_COMPILER
# pragma warning(push)
# pragma warning(disable:810) /* conversion may lose significant bits */
#endif
DEBUGASSERT(ulnum <= (unsigned long) CURL_MASK_USHORT);
return (unsigned short)(ulnum & (unsigned long) CURL_MASK_USHORT);
#ifdef __INTEL_COMPILER
# pragma warning(pop)
#endif
}