Branch: Tag:

2015-08-05

2015-08-05 22:53:56 by Per Hedbor <ph@opera.com>

Added direct-access versions of get/set_unalignedX.

Curently enabled on x86_64 only.

162:    return (void *)p;   }    + #ifdef __x86_64__ + /* it is faster to just do the unaligned operation. */ + static INLINE unsigned INT64 ATTRIBUTE((unused)) get_unaligned64(const void *ptr) { +  return *(unsigned INT64*)ptr; + } +  + static INLINE unsigned INT32 ATTRIBUTE((unused)) get_unaligned32(const void *ptr) { +  return *(unsigned INT32*)ptr; + } +  + static INLINE unsigned INT16 ATTRIBUTE((unused)) get_unaligned16(const void *ptr) { +  return *(unsigned INT16*)ptr; + } +  + static INLINE void ATTRIBUTE((unused)) set_unaligned16(void *ptr,unsigned INT16 val) { +  *(unsigned INT16*)ptr = val; + } +  + static INLINE void ATTRIBUTE((unused)) set_unaligned32(void *ptr,unsigned INT32 val) { +  *(unsigned INT32*)ptr = val; + } +  + static INLINE void ATTRIBUTE((unused)) set_unaligned64(void *ptr,unsigned INT64 val) { +  *(unsigned INT64*)ptr = val; + } + #else   static INLINE unsigned INT64 ATTRIBUTE((unused)) get_unaligned64(const void * ptr) {    unsigned INT64 v;    memcpy(&v, ptr, 8);
191:   static INLINE void ATTRIBUTE((unused)) set_unaligned16(void * ptr, unsigned INT16 v) {    memcpy(ptr, &v, 2);   } + #endif      #include "pike_search.h"