Now that Paul has fixed the [u]intptr_t override on CHERI, I get this
compilation error:

gllib/rawmemchr.c:37:3: error: static_assert failed

This patch fixes it.


2023-11-07  Bruno Haible  <[email protected]>

        rawmemchr: Port to CHERI.
        * lib/rawmemchr.c (rawmemchr): Use 'unsigned long' instead of uintptr_t.

diff --git a/lib/rawmemchr.c b/lib/rawmemchr.c
index 45c6cd3527..6f2809071b 100644
--- a/lib/rawmemchr.c
+++ b/lib/rawmemchr.c
@@ -31,10 +31,10 @@ void *
 rawmemchr (const void *s, int c_in)
 {
   /* Change this typedef to experiment with performance.  */
-  typedef uintptr_t longword;
-  /* If you change the "uintptr_t", you should change UINTPTR_WIDTH to match.
+  typedef unsigned long longword;
+  /* If you change the "unsigned long", you should change ULONG_WIDTH to match.
      This verifies that the type does not have padding bits.  */
-  static_assert (UINTPTR_WIDTH == UCHAR_WIDTH * sizeof (longword));
+  static_assert (ULONG_WIDTH == UCHAR_WIDTH * sizeof (longword));
 
   const unsigned char *char_ptr;
   unsigned char c = c_in;




Reply via email to