Map string to char conversion to unsigned byte range
Build / AerScript (push) Successful in 12s

This commit is contained in:
2026-11-23 22:47:23 +01:00
parent b2e3d42f31
commit 948487fd31
2 changed files with 7 additions and 7 deletions
+6 -6
View File
@@ -15,12 +15,12 @@
* sxi64), not a byte. PH7_MemObjToChar() (engine/memobj.c:612-620) stores the
* integer unchanged: (char)128/233/255 give 128/233/255, but (char)256 gives
* 256 and (char)-1 gives -1 (no clamp); ph7_value_to_int() shows only a 32-bit
* view. The engine's string-to-char path is signed (engine/memobj.c:368,
* (int)zString[0]), so (char)chr(233) is -23; that path is OUT_OF_SCOPE here.
* This scripted Char class adds its own contract mask on top: CharOperand
* accepts only a char in 0..255 or a one-byte string mapped as an unsigned
* byte, and rejects values outside that range. It does not change the engine
* representation. Classifiers return FALSE for bytes >= 0x80. */
* view. Converting a one-byte string to char maps its first byte to 0..255,
* so (char)chr(233) is 233. This scripted Char class adds its own contract
* mask on top: CharOperand accepts only a char in 0..255 or a one-byte string
* mapped as an unsigned byte, and rejects values outside that range. It does
* not change the engine representation. Classifiers return FALSE for bytes
* >= 0x80. */
typedef int (*CharPred)(ph7_int64);