- 论坛徽章:
- 0
|
本帖最后由 huxk 于 2010-08-21 14:43 编辑
滑鐵盧 這個搞法解釋一下。謝謝。- /*
- #if (NGX_MEMCPY_LIMIT)
- void *ngx_memcpy(void *dst, void *src, size_t n);
- #define ngx_cpymem(dst, src, n) ((u_char *) ngx_memcpy(dst, src, n)) + (n)
- #else
- * gcc3, msvc, and icc7 compile memcpy() to the inline "rep movs".
- * gcc3 compiles memcpy(d, s, 4) to the inline "mov"es.
- * icc8 compile memcpy(d, s, 4) to the inline "mov"es or XMM moves.
- */
- #define ngx_memcpy(dst, src, n) (void) memcpy(dst, src, n)
- #define ngx_cpymem(dst, src, n) ((u_char *) memcpy(dst, src, n)) + (n)
- #endif
- #if ( __INTEL_COMPILER >= 800 )
- /*
- * the simple inline cycle copies the variable length strings up to 16
- * bytes faster than icc8 autodetecting _intel_fast_memcpy()
- */
- static ngx_inline u_char *
- ngx_copy(u_char *dst, u_char *src, size_t len)
- {
- if (len < 17)
- {
- while (len)
- {
- *dst++ = *src++;
- len--;
- }
- return dst;
- }
- else
- {
- return ngx_cpymem(dst, src, len);
- }
- }
复制代码 |
|