diff --git a/icu4c/source/common/cpputils.h b/icu4c/source/common/cpputils.h index 70e30bb593..de09aea142 100644 --- a/icu4c/source/common/cpputils.h +++ b/icu4c/source/common/cpputils.h @@ -16,40 +16,48 @@ #include "unicode/utypes.h" #include "cmemory.h" -#include "unicode/unistr.h" /*==========================================================================*/ /* Array copy utility functions */ /*==========================================================================*/ +static inline void uprv_arrayCopy(const double* src, double* dst, int32_t count) { uprv_memcpy(dst, src, (size_t)(count * sizeof(*src))); } +static inline void uprv_arrayCopy(const double* src, int32_t srcStart, double* dst, int32_t dstStart, int32_t count) { uprv_memcpy(dst+dstStart, src+srcStart, (size_t)(count * sizeof(*src))); } +static inline void uprv_arrayCopy(const int8_t* src, int8_t* dst, int32_t count) { uprv_memcpy(dst, src, (size_t)(count * sizeof(*src))); } +static inline void uprv_arrayCopy(const int8_t* src, int32_t srcStart, int8_t* dst, int32_t dstStart, int32_t count) { uprv_memcpy(dst+dstStart, src+srcStart, (size_t)(count * sizeof(*src))); } +static inline void uprv_arrayCopy(const int16_t* src, int16_t* dst, int32_t count) { uprv_memcpy(dst, src, (size_t)(count * sizeof(*src))); } +static inline void uprv_arrayCopy(const int16_t* src, int32_t srcStart, int16_t* dst, int32_t dstStart, int32_t count) { uprv_memcpy(dst+dstStart, src+srcStart, (size_t)(count * sizeof(*src))); } +static inline void uprv_arrayCopy(const int32_t* src, int32_t* dst, int32_t count) { uprv_memcpy(dst, src, (size_t)(count * sizeof(*src))); } +static inline void uprv_arrayCopy(const int32_t* src, int32_t srcStart, int32_t* dst, int32_t dstStart, int32_t count) { uprv_memcpy(dst+dstStart, src+srcStart, (size_t)(count * sizeof(*src))); } +static inline void uprv_arrayCopy(const UChar *src, int32_t srcStart, UChar *dst, int32_t dstStart, int32_t count) diff --git a/icu4c/source/common/unicode/utypes.h b/icu4c/source/common/unicode/utypes.h index 76a99c2668..84b3b93e51 100644 --- a/icu4c/source/common/unicode/utypes.h +++ b/icu4c/source/common/unicode/utypes.h @@ -471,18 +471,18 @@ typedef enum UErrorCode UErrorCode; /* operational success or failure. */ #ifdef XP_CPLUSPLUS -U_NAMESPACE_BEGIN /** * Does the error code indicate success? * @stable */ + static inline UBool U_SUCCESS(UErrorCode code) { return (UBool)(code<=U_ZERO_ERROR); } /** * Does the error code indicate a failure? * @stable */ + static inline UBool U_FAILURE(UErrorCode code) { return (UBool)(code>U_ZERO_ERROR); } -U_NAMESPACE_END #else /** * Does the error code indicate success?