Mercurial > hg > xemacs-beta
changeset 5939:96fb76dd98df cygwin
fix bad interaction with Cygwin 3.3
author | Henry Thompson <ht@markup.co.uk> |
---|---|
date | Wed, 08 Dec 2021 18:49:22 +0000 |
parents | 699264ac20f1 |
children | |
files | src/file-coding.c src/text.c src/text.h |
diffstat | 3 files changed, 2 insertions(+), 77 deletions(-) [+] |
line wrap: on
line diff
--- a/src/file-coding.c Wed Dec 08 18:43:18 2021 +0000 +++ b/src/file-coding.c Wed Dec 08 18:49:22 2021 +0000 @@ -80,6 +80,7 @@ #include "rangetab.h" #include "chartab.h" #include "sysfile.h" +#include "skip-ascii.h" #ifdef HAVE_ZLIB #include "zlib.h"
--- a/src/text.c Wed Dec 08 18:43:18 2021 +0000 +++ b/src/text.c Wed Dec 08 18:49:22 2021 +0000 @@ -31,6 +31,7 @@ #include "file-coding.h" #include "lstream.h" #include "profile.h" +#include "skip-ascii.h" /************************************************************************/
--- a/src/text.h Wed Dec 08 18:43:18 2021 +0000 +++ b/src/text.h Wed Dec 08 18:49:22 2021 +0000 @@ -831,83 +831,6 @@ } } -#ifdef EFFICIENT_INT_128_BIT -# define STRIDE_TYPE INT_128_BIT -# define HIGH_BIT_MASK \ - MAKE_128_BIT_UNSIGNED_CONSTANT (0x80808080808080808080808080808080) -#elif defined (EFFICIENT_INT_64_BIT) -# define STRIDE_TYPE INT_64_BIT -# define HIGH_BIT_MASK MAKE_64_BIT_UNSIGNED_CONSTANT (0x8080808080808080) -#else -# define STRIDE_TYPE INT_32_BIT -# define HIGH_BIT_MASK MAKE_32_BIT_UNSIGNED_CONSTANT (0x80808080) -#endif - -#define ALIGN_BITS ((EMACS_UINT) (ALIGNOF (STRIDE_TYPE) - 1)) -#define ALIGN_MASK (~ ALIGN_BITS) -#define ALIGNED(ptr) ((((EMACS_UINT) ptr) & ALIGN_BITS) == 0) -#define STRIDE sizeof (STRIDE_TYPE) - -/* Skip as many ASCII bytes as possible in the memory block [PTR, END). - Return pointer to the first non-ASCII byte. optimized for long - stretches of ASCII. */ -DECLARE_INLINE_HEADER ( -const Ibyte * -skip_ascii (const Ibyte *ptr, const Ibyte *end) -) -{ - const unsigned STRIDE_TYPE *ascii_end; - - /* Need to do in 3 sections -- before alignment start, aligned chunk, - after alignment end. */ - while (!ALIGNED (ptr)) - { - if (ptr == end || !byte_ascii_p (*ptr)) - return ptr; - ptr++; - } - ascii_end = (const unsigned STRIDE_TYPE *) ptr; - /* This loop screams, because we can detect ASCII - characters 4 or 8 at a time. */ - while ((const Ibyte *) ascii_end + STRIDE <= end - && !(*ascii_end & HIGH_BIT_MASK)) - ascii_end++; - ptr = (Ibyte *) ascii_end; - while (ptr < end && byte_ascii_p (*ptr)) - ptr++; - return ptr; -} - -/* Skip as many ASCII bytes as possible in the memory block [END, PTR), - going downwards. Return pointer to the location above the first - non-ASCII byte. Optimized for long stretches of ASCII. */ -DECLARE_INLINE_HEADER ( -const Ibyte * -skip_ascii_down (const Ibyte *ptr, const Ibyte *end) -) -{ - const unsigned STRIDE_TYPE *ascii_end; - - /* Need to do in 3 sections -- before alignment start, aligned chunk, - after alignment end. */ - while (!ALIGNED (ptr)) - { - if (ptr == end || !byte_ascii_p (*(ptr - 1))) - return ptr; - ptr--; - } - ascii_end = (const unsigned STRIDE_TYPE *) ptr - 1; - /* This loop screams, because we can detect ASCII - characters 4 or 8 at a time. */ - while ((const Ibyte *) ascii_end >= end - && !(*ascii_end & HIGH_BIT_MASK)) - ascii_end--; - ptr = (Ibyte *) (ascii_end + 1); - while (ptr > end && byte_ascii_p (*(ptr - 1))) - ptr--; - return ptr; -} - /* Return the character count of an lstream or coding buffer of internal format text, counting partial characters at the beginning of the buffer as whole characters, and *not* counting partial characters at the end of