@@ -84,18 +84,9 @@ static void rvalue_cache_insert_at(rvalue_cache *cache, int index, VALUE rstring
8484 cache -> entries [index ] = rstring ;
8585}
8686
87- static ALWAYS_INLINE () int rstring_cache_cmp (const char * str , const long length , VALUE rstring )
88- {
8987#if defined(__BYTE_ORDER__ ) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ ) && defined(__has_builtin ) && __has_builtin (__builtin_bswap64 )
90- const char * rptr ;
91- long rstring_length ;
92-
93- RSTRING_GETMEM (rstring , rptr , rstring_length );
94-
95- if (length != rstring_length ) {
96- return (int )(length - rstring_length );
97- }
98-
88+ static ALWAYS_INLINE () int rstring_memcmp (const char * str , const char * rptr , const long length )
89+ {
9990 long i = 0 ;
10091
10192 for (; i + 8 <= length ; i += 8 ) {
@@ -118,14 +109,23 @@ static ALWAYS_INLINE() int rstring_cache_cmp(const char *str, const long length,
118109 }
119110
120111 return 0 ;
112+ }
121113#else
122- long rstring_length = RSTRING_LEN (rstring );
123- if (length == rstring_length ) {
124- return memcmp (str , RSTRING_PTR (rstring ), length );
125- } else {
114+ #define rstring_memcmp memcmp
115+ #endif
116+
117+ static ALWAYS_INLINE () int rstring_cache_cmp (const char * str , const long length , VALUE rstring )
118+ {
119+ const char * rptr ;
120+ long rstring_length ;
121+
122+ RSTRING_GETMEM (rstring , rptr , rstring_length );
123+
124+ if (length != rstring_length ) {
126125 return (int )(length - rstring_length );
127126 }
128- #endif
127+
128+ return rstring_memcmp (str , rptr , length );
129129}
130130
131131static ALWAYS_INLINE () VALUE rstring_cache_fetch (rvalue_cache * cache , const char * str , const long length )
0 commit comments