]> git.saurik.com Git - apple/icu.git/blame - icuSources/common/cpputils.h
ICU-400.37.tar.gz
[apple/icu.git] / icuSources / common / cpputils.h
CommitLineData
b75a7d8f
A
1/*
2******************************************************************************
3*
73c04bcf 4* Copyright (C) 1997-2006, International Business Machines
b75a7d8f
A
5* Corporation and others. All Rights Reserved.
6*
7******************************************************************************
8* file name: cpputils.h
9* encoding: US-ASCII
10* tab size: 8 (not used)
11* indentation:4
12*/
13
14#ifndef CPPUTILS_H
15#define CPPUTILS_H
16
17#include "unicode/utypes.h"
73c04bcf 18#include "unicode/unistr.h"
b75a7d8f
A
19#include "cmemory.h"
20
21/*==========================================================================*/
22/* Array copy utility functions */
23/*==========================================================================*/
24
25static
26inline void uprv_arrayCopy(const double* src, double* dst, int32_t count)
27{ uprv_memcpy(dst, src, (size_t)(count * sizeof(*src))); }
28
29static
30inline void uprv_arrayCopy(const double* src, int32_t srcStart,
31 double* dst, int32_t dstStart, int32_t count)
32{ uprv_memcpy(dst+dstStart, src+srcStart, (size_t)(count * sizeof(*src))); }
33
34static
35inline void uprv_arrayCopy(const int8_t* src, int8_t* dst, int32_t count)
36 { uprv_memcpy(dst, src, (size_t)(count * sizeof(*src))); }
37
38static
39inline void uprv_arrayCopy(const int8_t* src, int32_t srcStart,
40 int8_t* dst, int32_t dstStart, int32_t count)
41{ uprv_memcpy(dst+dstStart, src+srcStart, (size_t)(count * sizeof(*src))); }
42
43static
44inline void uprv_arrayCopy(const int16_t* src, int16_t* dst, int32_t count)
45{ uprv_memcpy(dst, src, (size_t)(count * sizeof(*src))); }
46
47static
48inline void uprv_arrayCopy(const int16_t* src, int32_t srcStart,
49 int16_t* dst, int32_t dstStart, int32_t count)
50{ uprv_memcpy(dst+dstStart, src+srcStart, (size_t)(count * sizeof(*src))); }
51
52static
53inline void uprv_arrayCopy(const int32_t* src, int32_t* dst, int32_t count)
54{ uprv_memcpy(dst, src, (size_t)(count * sizeof(*src))); }
55
56static
57inline void uprv_arrayCopy(const int32_t* src, int32_t srcStart,
58 int32_t* dst, int32_t dstStart, int32_t count)
59{ uprv_memcpy(dst+dstStart, src+srcStart, (size_t)(count * sizeof(*src))); }
60
61static
62inline void
63uprv_arrayCopy(const UChar *src, int32_t srcStart,
64 UChar *dst, int32_t dstStart, int32_t count)
65{ uprv_memcpy(dst+dstStart, src+srcStart, (size_t)(count * sizeof(*src))); }
66
73c04bcf
A
67/**
68 * Copy an array of UnicodeString OBJECTS (not pointers).
69 * @internal
70 */
71static inline void
72uprv_arrayCopy(const U_NAMESPACE_QUALIFIER UnicodeString *src, U_NAMESPACE_QUALIFIER UnicodeString *dst, int32_t count)
73{ while(count-- > 0) *dst++ = *src++; }
74
75/**
76 * Copy an array of UnicodeString OBJECTS (not pointers).
77 * @internal
78 */
79static inline void
80uprv_arrayCopy(const U_NAMESPACE_QUALIFIER UnicodeString *src, int32_t srcStart,
81 U_NAMESPACE_QUALIFIER UnicodeString *dst, int32_t dstStart, int32_t count)
82{ uprv_arrayCopy(src+srcStart, dst+dstStart, count); }
83
b75a7d8f 84#endif /* _CPPUTILS */