diff options
Diffstat (limited to 'ace/OS_NS_string.inl')
-rw-r--r-- | ace/OS_NS_string.inl | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/ace/OS_NS_string.inl b/ace/OS_NS_string.inl index 46d13953d89..399b681924c 100644 --- a/ace/OS_NS_string.inl +++ b/ace/OS_NS_string.inl @@ -52,7 +52,56 @@ ACE_OS::memmove (void *t, const void *s, size_t len) ACE_INLINE void * ACE_OS::memset (void *s, int c, size_t len) { +#if defined (ACE_HAS_SLOW_MEMSET) + // This section requires a high optimization level (-xO4 with SunCC) + // in order to actually be inlined. + char* ptr = static_cast<char*> (s); + switch (len) + { + case 16: + ptr[15] = c; + case 15: + ptr[14] = c; + case 14: + ptr[13] = c; + case 13: + ptr[12] = c; + case 12: + ptr[11] = c; + case 11: + ptr[10] = c; + case 10: + ptr[9] = c; + case 9: + ptr[8] = c; + case 8: + ptr[7] = c; + case 7: + ptr[6] = c; + case 6: + ptr[5] = c; + case 5: + ptr[4] = c; + case 4: + ptr[3] = c; + case 3: + ptr[2] = c; + case 2: + ptr[1] = c; + case 1: + ptr[0] = c; + break; + default: + for (size_t i = 0; i < len; ++i) + { + ptr[i] = c; + } + } + + return s; +#else return ::memset (s, c, len); +#endif /* ACE_HAS_SLOW_MEMSET */ } ACE_INLINE char * |