aboutsummaryrefslogtreecommitdiff
path: root/src/lj_str.c
diff options
context:
space:
mode:
authorMike Pall <mike>2020-06-13 00:52:54 +0200
committerMike Pall <mike>2020-06-15 02:52:00 +0200
commit8ae5170cdc9c307bd81019b3e014391c9fd00581 (patch)
treeccf9f17035d0754c1758faee209e9a26b4e03418 /src/lj_str.c
parent8b55054473452963f24b01efb7c4cc72497c74ec (diff)
downloadluajit-8ae5170cdc9c307bd81019b3e014391c9fd00581.tar.gz
luajit-8ae5170cdc9c307bd81019b3e014391c9fd00581.tar.bz2
luajit-8ae5170cdc9c307bd81019b3e014391c9fd00581.zip
Improve assertions.
Diffstat (limited to 'src/lj_str.c')
-rw-r--r--src/lj_str.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lj_str.c b/src/lj_str.c
index ec74afa5..0253c15e 100644
--- a/src/lj_str.c
+++ b/src/lj_str.c
@@ -41,8 +41,9 @@ int32_t LJ_FASTCALL lj_str_cmp(GCstr *a, GCstr *b)
41static LJ_AINLINE int str_fastcmp(const char *a, const char *b, MSize len) 41static LJ_AINLINE int str_fastcmp(const char *a, const char *b, MSize len)
42{ 42{
43 MSize i = 0; 43 MSize i = 0;
44 lua_assert(len > 0); 44 lj_assertX(len > 0, "fast string compare with zero length");
45 lua_assert((((uintptr_t)a+len-1) & (LJ_PAGESIZE-1)) <= LJ_PAGESIZE-4); 45 lj_assertX((((uintptr_t)a+len-1) & (LJ_PAGESIZE-1)) <= LJ_PAGESIZE-4,
46 "fast string compare crossing page boundary");
46 do { /* Note: innocuous access up to end of string + 3. */ 47 do { /* Note: innocuous access up to end of string + 3. */
47 uint32_t v = lj_getu32(a+i) ^ *(const uint32_t *)(b+i); 48 uint32_t v = lj_getu32(a+i) ^ *(const uint32_t *)(b+i);
48 if (v) { 49 if (v) {