Skip to content

Commit 59dbc92

Browse files
author
Alex Cole
committed
Managed to shave off like two instructions...
1 parent 5a9b346 commit 59dbc92

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

core.inc

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ native getarg(arg, index = 0);
7373
* <seealso name="numargs"/>
7474
* <returns><b><c>1</c></b> on success and <b><c>0</c></b> if the argument or the index are invalid.</returns>
7575
*/
76-
native setarg(arg, index = 0, value);
76+
native bool:setarg(arg, index = 0, value);
7777

7878
/**
7979
* <library>core</library>
@@ -233,20 +233,19 @@ static stock __findpubvar(const __name[])
233233
#emit NEG
234234
// Store this offset. We'll need it a lot.
235235
#emit MOVE.alt
236-
#emit STOR.S.alt __offset
236+
#emit STOR.S.pri __offset
237237
// Get the offset to the pubvars pointer.
238238
#emit ADD.C 44 // Doesn't change with `cellbits`.
239239
#emit STOR.S.pri __start
240+
#emit ADD.C 4 // Doesn't change with `cellbits`.
241+
#emit STOR.S.pri __end
240242
#emit LREF.S.pri __start
241243
// Make this pointer relative to `DAT`.
242244
#emit ADD
243245
// Point to the name pointer in the entry to begin with.
244246
#emit ADD.C __cellbytes
245247
#emit STOR.S.pri __start
246248
// Get the offset to the tags pointer.
247-
#emit MOVE.pri
248-
#emit ADD.C 48 // Doesn't change with `cellbits`.
249-
#emit STOR.S.pri __end
250249
#emit LREF.S.pri __end
251250
#emit ADD
252251
#emit ADD.C __cellbytes
@@ -395,15 +394,14 @@ stock numpubvars()
395394
// Get the offset to the pubvars pointer.
396395
#emit ADD.C 44 // Doesn't change with `cellbits`.
397396
#emit STOR.S.pri __start
398-
#emit LREF.S.pri __start
399-
#emit STOR.S.pri __start
400397
// Get the offset to the tags pointer.
401-
#emit LCTRL 1
402-
#emit NEG
403-
#emit ADD.C 48 // Doesn't change with `cellbits`.
398+
#emit ADD.C 4 // Doesn't change with `cellbits`.
404399
#emit STOR.S.pri __end
400+
// Load both values.
401+
#emit LREF.S.alt __start
405402
#emit LREF.S.pri __end
403+
#emit SUB
406404
#emit STOR.S.pri __end
407-
return (__end - __start) / __defsize;
405+
return __end / __defsize;
408406
}
409407

0 commit comments

Comments
 (0)