Improve assertions.
This commit is contained in:
@@ -41,8 +41,9 @@ int32_t LJ_FASTCALL lj_str_cmp(GCstr *a, GCstr *b)
|
||||
static LJ_AINLINE int str_fastcmp(const char *a, const char *b, MSize len)
|
||||
{
|
||||
MSize i = 0;
|
||||
lua_assert(len > 0);
|
||||
lua_assert((((uintptr_t)a+len-1) & (LJ_PAGESIZE-1)) <= LJ_PAGESIZE-4);
|
||||
lj_assertX(len > 0, "fast string compare with zero length");
|
||||
lj_assertX((((uintptr_t)a+len-1) & (LJ_PAGESIZE-1)) <= LJ_PAGESIZE-4,
|
||||
"fast string compare crossing page boundary");
|
||||
do { /* Note: innocuous access up to end of string + 3. */
|
||||
uint32_t v = lj_getu32(a+i) ^ *(const uint32_t *)(b+i);
|
||||
if (v) {
|
||||
|
||||
Reference in New Issue
Block a user