diff options
| author | Li Jin <dragon-fly@qq.com> | 2023-08-24 09:21:38 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2023-08-24 09:21:38 +0800 |
| commit | cfcea12ba0e6a40d7c04ac64c75563db0896985c (patch) | |
| tree | 8ee7c6d9cd5f7b60fd9bda035b703cc9969ab678 /src/3rdParty/lua/lobject.h | |
| parent | eb48c686a7ab5bd3f3f3a8628ed0423872a932c6 (diff) | |
| download | yuescript-cfcea12ba0e6a40d7c04ac64c75563db0896985c.tar.gz yuescript-cfcea12ba0e6a40d7c04ac64c75563db0896985c.tar.bz2 yuescript-cfcea12ba0e6a40d7c04ac64c75563db0896985c.zip | |
update Lua 5.4.
Diffstat (limited to '')
| -rw-r--r-- | src/3rdParty/lua/lobject.h | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/3rdParty/lua/lobject.h b/src/3rdParty/lua/lobject.h index 556608e..980e42f 100644 --- a/src/3rdParty/lua/lobject.h +++ b/src/3rdParty/lua/lobject.h | |||
| @@ -386,7 +386,7 @@ typedef struct GCObject { | |||
| 386 | typedef struct TString { | 386 | typedef struct TString { |
| 387 | CommonHeader; | 387 | CommonHeader; |
| 388 | lu_byte extra; /* reserved words for short strings; "has hash" for longs */ | 388 | lu_byte extra; /* reserved words for short strings; "has hash" for longs */ |
| 389 | lu_byte shrlen; /* length for short strings */ | 389 | lu_byte shrlen; /* length for short strings, 0xFF for long strings */ |
| 390 | unsigned int hash; | 390 | unsigned int hash; |
| 391 | union { | 391 | union { |
| 392 | size_t lnglen; /* length for long strings */ | 392 | size_t lnglen; /* length for long strings */ |
| @@ -398,19 +398,17 @@ typedef struct TString { | |||
| 398 | 398 | ||
| 399 | 399 | ||
| 400 | /* | 400 | /* |
| 401 | ** Get the actual string (array of bytes) from a 'TString'. | 401 | ** Get the actual string (array of bytes) from a 'TString'. (Generic |
| 402 | ** version and specialized versions for long and short strings.) | ||
| 402 | */ | 403 | */ |
| 403 | #define getstr(ts) ((ts)->contents) | 404 | #define getstr(ts) ((ts)->contents) |
| 405 | #define getlngstr(ts) check_exp((ts)->shrlen == 0xFF, (ts)->contents) | ||
| 406 | #define getshrstr(ts) check_exp((ts)->shrlen != 0xFF, (ts)->contents) | ||
| 404 | 407 | ||
| 405 | 408 | ||
| 406 | /* get the actual string (array of bytes) from a Lua value */ | ||
| 407 | #define svalue(o) getstr(tsvalue(o)) | ||
| 408 | |||
| 409 | /* get string length from 'TString *s' */ | 409 | /* get string length from 'TString *s' */ |
| 410 | #define tsslen(s) ((s)->tt == LUA_VSHRSTR ? (s)->shrlen : (s)->u.lnglen) | 410 | #define tsslen(s) \ |
| 411 | 411 | ((s)->shrlen != 0xFF ? (s)->shrlen : (s)->u.lnglen) | |
| 412 | /* get string length from 'TValue *o' */ | ||
| 413 | #define vslen(o) tsslen(tsvalue(o)) | ||
| 414 | 412 | ||
| 415 | /* }================================================================== */ | 413 | /* }================================================================== */ |
| 416 | 414 | ||
