diff --git a/pkg/lua/contrib/binsearch.h b/pkg/lua/contrib/binsearch.h
index 9be7ca3db4c04dae8cd9cac9d15edec27d14ae44..dad65da1e24781259da4bbef960076c7066338f5 100644
--- a/pkg/lua/contrib/binsearch.h
+++ b/pkg/lua/contrib/binsearch.h
@@ -60,14 +60,14 @@ extern "C" {
  * UNSAFE MACRO: Difference in bytes between the addresses of two consecutive
  * array elements.
  */
-#define _ARRAY_STRIDE(arr) ((size_t)((uint8_t *)((arr) + 1) - (uint8_t *)(arr)))
+#define _ARRAY_STRIDE(arr) ((size_t)((const uint8_t *)((arr) + 1) - (const uint8_t *)(arr)))
 
 /**
  * UNSAFE MACRO: Offset in bytes from the start of the array to member "member"
  * of the first element.
  */
 #define _ARRAY_MEMBER_OFFS(arr, member) \
-    ((size_t)((uint8_t *)(&((arr)->member)) - (uint8_t *)(arr)))
+    ((size_t)((const uint8_t *)(&((arr)->member)) - (const uint8_t *)(arr)))
 
 /**
  * Find the index of the array element that contains "str" in