2 /* Copyright (C) 2010 by Daniel Stenberg
4 * Permission to use, copy, modify, and distribute this
5 * software and its documentation for any purpose and without
6 * fee is hereby granted, provided that the above copyright
7 * notice appear in all copies and that both that copyright
8 * notice and this permission notice appear in supporting
9 * documentation, and that the name of M.I.T. not be used in
10 * advertising or publicity pertaining to distribution of the
11 * software without specific, written prior permission.
12 * M.I.T. makes no representations about the suitability of
13 * this software for any purpose. It is provided "as is"
14 * without express or implied warranty.
18 #include "ares_setup.h"
20 #include "ares_nowarn.h"
23 # define CARES_MASK_SINT 0x7FFF
24 # define CARES_MASK_UINT 0xFFFF
25 #elif (SIZEOF_INT == 4)
26 # define CARES_MASK_SINT 0x7FFFFFFF
27 # define CARES_MASK_UINT 0xFFFFFFFF
28 #elif (SIZEOF_INT == 8)
29 # define CARES_MASK_SINT 0x7FFFFFFFFFFFFFFF
30 # define CARES_MASK_UINT 0xFFFFFFFFFFFFFFFF
31 #elif (SIZEOF_INT == 16)
32 # define CARES_MASK_SINT 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
33 # define CARES_MASK_UINT 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
37 ** size_t to signed int
40 int aresx_uztosi(size_t uznum)
42 #ifdef __INTEL_COMPILER
43 # pragma warning(push)
44 # pragma warning(disable:810) /* conversion may lose significant bits */
47 return (int)(uznum & (size_t) CARES_MASK_SINT);
49 #ifdef __INTEL_COMPILER
55 ** signed long to signed int
58 int aresx_sltosi(long slnum)
60 #ifdef __INTEL_COMPILER
61 # pragma warning(push)
62 # pragma warning(disable:810) /* conversion may lose significant bits */
65 return (int)(slnum & (long) CARES_MASK_SINT);
67 #ifdef __INTEL_COMPILER