Merge pull request #111 from InnaKhachikyan/master

modified Index checking to handle run-time variable index containing …
This commit is contained in:
Norayr Chilingarian 2025-04-23 02:46:44 +04:00 committed by GitHub
commit 94683df1d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -116,9 +116,11 @@ extern void Modules_AssertFail(INT32 x);
// Index checking
static inline INT64 __XF(UINT64 i, UINT64 ub) {if (i >= ub) {__HALT(-2);} return i;}
#define __X(i, ub) (((i)<(ub))?i:(__HALT(-2),0))
static inline INT64 __XF(INT64 i, UINT64 ub) {
if (i < 0 || (UINT64)i >= ub) __HALT(-2);
return i;
}
#define __X(i, ub) (((i) >= 0 && (i) < (ub)) ? (i) : (__HALT(-2),0))
// Range checking, and checked SHORT and CHR functions