/*
******************************************************************************
*
-* Copyright (C) 1997-2004, International Business Machines
+* Copyright (C) 1997-2010, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
*/
U_INTERNAL double U_EXPORT2 uprv_maxMantissa(void);
-/**
- * Return the floor of the log base 10 of a given double.
- * This method compensates for inaccuracies which arise naturally when
- * computing logs, and always gives the correct value. The parameter
- * must be positive and finite.
- * (Thanks to Alan Liu for supplying this function.)
- *
- * @param d the double value to apply the common log function for.
- * @return the log of value d.
- * @internal
- */
-U_INTERNAL int16_t U_EXPORT2 uprv_log10(double d);
-
/**
* Floating point utility to calculate the logarithm of a double.
* @internal
* Time zone utilities
*
* Wrappers for C runtime library functions relating to timezones.
- * The t_tzset() function (similar to tzset) uses the current setting
- * of the environment variable TZ to assign values to three global
- * variables: daylight, timezone, and tzname. These variables have the
+ * The t_tzset() function (similar to tzset) uses the current setting
+ * of the environment variable TZ to assign values to three global
+ * variables: daylight, timezone, and tzname. These variables have the
* following meanings, and are declared in <time.h>.
*
* daylight Nonzero if daylight-saving-time zone (DST) is specified
/**
* Get UTC (GMT) time measured in milliseconds since 0:00 on 1/1/1970.
- * @return the UTC time measured in milliseconds
+ * This function is affected by 'faketime' and should be the bottleneck for all user-visible ICU time functions.
+ * @return the UTC time measured in milliseconds
* @internal
*/
U_INTERNAL UDate U_EXPORT2 uprv_getUTCtime(void);
+/**
+ * Get UTC (GMT) time measured in milliseconds since 0:00 on 1/1/1970.
+ * This function is not affected by 'faketime', so it should only be used by low level test functions- not by anything that
+ * exposes time to the end user.
+ * @return the UTC time measured in milliseconds
+ * @internal
+ */
+U_INTERNAL UDate U_EXPORT2 uprv_getRawUTCtime(void);
+
/**
* Determine whether a pathname is absolute or not, as defined by the platform.
* @param path Pathname to test
*/
U_INTERNAL UBool U_EXPORT2 uprv_pathIsAbsolute(const char *path);
+/**
+ * Use U_MAX_PTR instead of this function.
+ * @param void pointer to test
+ * @return the largest possible pointer greater than the base
+ * @internal (ICU 3.8)
+ */
+U_INTERNAL void * U_EXPORT2 uprv_maximumPtr(void *base);
+
/**
* Maximum value of a (void*) - use to indicate the limit of an 'infinite' buffer.
* In fact, buffer sizes must not exceed 2GB so that the difference between
* @internal
*/
#ifndef U_MAX_PTR
-# ifdef OS390
+# if defined(OS390) && !defined(_LP64)
+ /* We have 31-bit pointers. */
# define U_MAX_PTR(base) ((void *)0x7fffffff)
# elif defined(OS400)
+# define U_MAX_PTR(base) uprv_maximumPtr((void *)base)
+# elif defined(__GNUC__) && __GNUC__ >= 4
/*
- * With the provided macro we should never be out of range of a given segment
- * (a traditional/typical segment that is). Our segments have 5 bytes for the id
- * and 3 bytes for the offset. The key is that the casting takes care of only
- * retrieving the offset portion minus x1000. Hence, the smallest offset seen in
- * a program is x001000 and when casted to an int would be 0. That's why we can
- * only add 0xffefff. Otherwise, we would exceed the segment.
- *
- * Currently, 16MB is the current addressing limitation on as/400. This macro
- * may eventually be changed to use 2GB addressability for the newer version of
- * as/400 machines.
+ * Due to a compiler optimization bug, gcc 4 causes test failures when doing
+ * this math arithmetic on pointers on some platforms. It seems like the
+ * pointers are considered signed instead of unsigned. The uintptr_t type
+ * isn't available on all platforms (i.e MSVC 6) and pointers aren't always
+ * a scalar value (i.e. i5/OS see uprv_maximumPtr function).
*/
-# define U_MAX_PTR(base) ((void *)(((char *)base)-((int32_t)(base))+((int32_t)0xffefff)))
+# define U_MAX_PTR(base) \
+ ((void *)(((uintptr_t)(base)+0x7fffffffu) > (uintptr_t)(base) \
+ ? ((uintptr_t)(base)+0x7fffffffu) \
+ : (uintptr_t)-1))
# else
-# define U_MAX_PTR(base) ((void *)(((char *)(base)+0x7fffffffu) > (char *)(base) ? ((char *)(base)+0x7fffffffu) : (char *)-1))
+# define U_MAX_PTR(base) \
+ ((char *)(((char *)(base)+0x7fffffffu) > (char *)(base) \
+ ? ((char *)(base)+0x7fffffffu) \
+ : (char *)-1))
# endif
#endif
+#if U_ENABLE_DYLOAD
+/* Dynamic Library Functions */
+
+/**
+ * Load a library
+ * @internal (ICU 4.4)
+ */
+U_INTERNAL void * U_EXPORT2 uprv_dl_open(const char *libName, UErrorCode *status);
+
+/**
+ * Close a library
+ * @internal (ICU 4.4)
+ */
+U_INTERNAL void U_EXPORT2 uprv_dl_close( void *lib, UErrorCode *status);
+
+/**
+ * Extract a symbol from a library
+ * @internal (ICU 4.4)
+ */
+U_INTERNAL void * U_EXPORT2 uprv_dl_sym( void *lib, const char *symbolName, UErrorCode *status);
+
+#endif
+
#endif