|
@@ -28,6 +28,14 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
|
28
|
28
|
extern void * __memcpy ( void *dest, const void *src, size_t len );
|
29
|
29
|
extern void * __memcpy_reverse ( void *dest, const void *src, size_t len );
|
30
|
30
|
|
|
31
|
+/**
|
|
32
|
+ * Copy memory area (where length is a compile-time constant)
|
|
33
|
+ *
|
|
34
|
+ * @v dest Destination address
|
|
35
|
+ * @v src Source address
|
|
36
|
+ * @v len Length
|
|
37
|
+ * @ret dest Destination address
|
|
38
|
+ */
|
31
|
39
|
static inline __attribute__ (( always_inline )) void *
|
32
|
40
|
__constant_memcpy ( void *dest, const void *src, size_t len ) {
|
33
|
41
|
union {
|
|
@@ -139,10 +147,22 @@ __constant_memcpy ( void *dest, const void *src, size_t len ) {
|
139
|
147
|
return dest;
|
140
|
148
|
}
|
141
|
149
|
|
142
|
|
-#define memcpy( dest, src, len ) \
|
143
|
|
- ( __builtin_constant_p ( (len) ) ? \
|
144
|
|
- __constant_memcpy ( (dest), (src), (len) ) : \
|
145
|
|
- __memcpy ( (dest), (src), (len) ) )
|
|
150
|
+/**
|
|
151
|
+ * Copy memory area
|
|
152
|
+ *
|
|
153
|
+ * @v dest Destination address
|
|
154
|
+ * @v src Source address
|
|
155
|
+ * @v len Length
|
|
156
|
+ * @ret dest Destination address
|
|
157
|
+ */
|
|
158
|
+static inline __attribute__ (( always_inline )) void *
|
|
159
|
+memcpy ( void *dest, const void *src, size_t len ) {
|
|
160
|
+ if ( __builtin_constant_p ( len ) ) {
|
|
161
|
+ return __constant_memcpy ( dest, src, len );
|
|
162
|
+ } else {
|
|
163
|
+ return __memcpy ( dest, src, len );
|
|
164
|
+ }
|
|
165
|
+}
|
146
|
166
|
|
147
|
167
|
#define __HAVE_ARCH_MEMMOVE
|
148
|
168
|
|