aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias EngdegÄrd2023-04-01 10:53:50 +0200
committerMattias EngdegÄrd2023-04-01 11:00:34 +0200
commitf5891da70aae4deb465e8f193a172fbad0b4485f (patch)
treeb2fa69c9001a1e952e6a4978768b7cf5ed004114 /src
parent4bd1fc59664273c571aba8543940768c68eb336b (diff)
downloademacs-f5891da70aae4deb465e8f193a172fbad0b4485f.tar.gz
emacs-f5891da70aae4deb465e8f193a172fbad0b4485f.zip
; * src/fns.c: Use if instead of #ifdef
* src/fns.c (HAVE_FAST_UNALIGNED_ACCESS, load_unaligned_size_t): Always define these. (Fstring_lessp): Use if instead of #ifdef.
Diffstat (limited to 'src')
-rw-r--r--src/fns.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/fns.c b/src/fns.c
index 47def5c43b4..e92ef7e4c81 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -452,6 +452,9 @@ If string STR1 is greater, the value is a positive number N;
452 || defined __s390__ || defined __s390x__) \ 452 || defined __s390__ || defined __s390x__) \
453 && defined __OPTIMIZE__ 453 && defined __OPTIMIZE__
454#define HAVE_FAST_UNALIGNED_ACCESS 1 454#define HAVE_FAST_UNALIGNED_ACCESS 1
455#else
456#define HAVE_FAST_UNALIGNED_ACCESS 0
457#endif
455 458
456/* Load a word from a possibly unaligned address. */ 459/* Load a word from a possibly unaligned address. */
457static inline size_t 460static inline size_t
@@ -462,8 +465,6 @@ load_unaligned_size_t (const void *p)
462 return x; 465 return x;
463} 466}
464 467
465#endif
466
467DEFUN ("string-lessp", Fstring_lessp, Sstring_lessp, 2, 2, 0, 468DEFUN ("string-lessp", Fstring_lessp, Sstring_lessp, 2, 2, 0,
468 doc: /* Return non-nil if STRING1 is less than STRING2 in lexicographic order. 469 doc: /* Return non-nil if STRING1 is less than STRING2 in lexicographic order.
469Case is significant. 470Case is significant.
@@ -504,18 +505,16 @@ Symbols are also allowed; their print names are used instead. */)
504 /* String data is normally allocated with word alignment, but 505 /* String data is normally allocated with word alignment, but
505 there are exceptions (notably pure strings) so we restrict the 506 there are exceptions (notably pure strings) so we restrict the
506 wordwise skipping to safe architectures. */ 507 wordwise skipping to safe architectures. */
507#ifdef HAVE_FAST_UNALIGNED_ACCESS 508 if (HAVE_FAST_UNALIGNED_ACCESS)
508 { 509 {
509 /* First compare entire machine words. */ 510 /* First compare entire machine words. */
510 int ws = sizeof (size_t); 511 int ws = sizeof (size_t);
511 const char *w1 = SSDATA (string1); 512 const char *w1 = SSDATA (string1);
512 const char *w2 = SSDATA (string2); 513 const char *w2 = SSDATA (string2);
513 while (b < nb - ws + 1 514 while (b < nb - ws + 1 && load_unaligned_size_t (w1 + b)
514 && (load_unaligned_size_t (w1 + b) 515 == load_unaligned_size_t (w2 + b))
515 == load_unaligned_size_t (w2 + b)))
516 b += ws; 516 b += ws;
517 } 517 }
518#endif
519 518
520 /* Scan forward to the differing byte. */ 519 /* Scan forward to the differing byte. */
521 while (b < nb && SREF (string1, b) == SREF (string2, b)) 520 while (b < nb && SREF (string1, b) == SREF (string2, b))