09.07.2012, 12:03
Thuper-duper-fast memset!
It modifies the FILL instruction's parameter on-the-fly. Linux compatible.
Demo:
It modifies the FILL instruction's parameter on-the-fly. Linux compatible.
Demo:
pawn Код:
new test[20] = {4, ...};
memset(test, sizeof(test), 1234);
for (new i = 0; i < sizeof(test); i++) {
printf("test[%d] = %d", i, test[i]);
}
pawn Код:
stock memset(variable[], cells, value) {
new address;
#emit LOAD.S.pri variable
#emit STOR.S.pri address
raw_memset(address, cells, value);
}
stock raw_memset(address, cells, value) {
new param_adr;
#emit LCTRL 6
#emit MOVE.alt
#emit LCTRL 0
#emit ADD
#emit MOVE.alt
#emit LCTRL 1
#emit SUB.alt
#emit ADD.C 92
#emit STOR.S.pri param_adr
#emit LOAD.S.pri cells
#emit SHL.C.pri 2
#emit SREF.S.pri param_adr
#emit LOAD.S.alt address
#emit LOAD.S.pri value
#emit FILL 0
}