@@ -302,6 +302,7 @@ native getpubvar(const name[]);
302302*/
303303stock getpubvar (const __name[])
304304{
305+ const __cellbytes = cellbits / charbits;
305306 new __entry = __findpubvar (__name);
306307 if (__entry)
307308 {
@@ -311,7 +312,7 @@ stock getpubvar(const __name[])
311312 // Get the old data (fortunately the pointer is relative to `DAT`).
312313 # emit LREF .S .pri __entry
313314 // Return the value in `pri`.
314- # emit STACK 4
315+ # emit STACK __cellbytes
315316 # emit RETN
316317 }
317318 return 0 ;
@@ -332,6 +333,7 @@ native setpubvar(const name[], value);
332333*/
333334stock setpubvar (const __name[], __value)
334335{
336+ const __cellbytes = cellbits / charbits;
335337 new __entry = __findpubvar (__name);
336338 if (__entry)
337339 {
@@ -344,7 +346,7 @@ stock setpubvar(const __name[], __value)
344346 # emit LOAD .S .alt __value
345347 # emit SREF .S .alt __entry
346348 // Return the value in `pri`.
347- # emit STACK 4
349+ # emit STACK __cellbytes
348350 # emit RETN
349351 }
350352 return 0 ;
@@ -380,9 +382,10 @@ native numpubvars();
380382*/
381383stock numpubvars ()
382384{
385+ const __cellbytes = cellbits / charbits;
383386 // In 32-bit scripts this is `64`, but in 64-bit scripts it is only `96`. Part of the header
384387 // entry is always 32-bit, regardless of the cell bit width. We need it in bytes.
385- const __defsize = cellbits / charbits + 4 ;
388+ const __defsize = __cellbytes + 4 ;
386389 new __start, __end;
387390 // Now we start doing assembly magic to dig through the AMX header itself.
388391 // Get the offset from the start of the file to the start of the data segment (DAT).
0 commit comments