SA-MP Forums Archive
what does this function do? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: what does this function do? (/showthread.php?tid=480537)



what does this function do? - dudaefj - 11.12.2013

PHP код:
stock fixmemset(aArray[], iValueiSize sizeof(aArray)) {
    new
        
iAddress
    
;
    
    
// Store the address of the array
    #emit LOAD.S.pri 12
    #emit STOR.S.pri iAddress
    
    // Convert the size from cells to bytes
    
iSize *= 4;
    
    
// Loop until there is nothing more to fill
    
while (iSize 0) {
        
// I have to do this because the FILL instruction doesn't accept a dynamic number.
        
if (iSize >= 4096) {
            
#emit LOAD.S.alt iAddress
            #emit LOAD.S.pri iValue
            #emit FILL 4096
        
            
iSize    -= 4096;
            
iAddress += 4096;
        } else if (
iSize >= 1024) {
            
#emit LOAD.S.alt iAddress
            #emit LOAD.S.pri iValue
            #emit FILL 1024
            
iSize    -= 1024;
            
iAddress += 1024;
        } else if (
iSize >= 256) {
            
#emit LOAD.S.alt iAddress
            #emit LOAD.S.pri iValue
            #emit FILL 256
            
iSize    -= 256;
            
iAddress += 256;
        } else if (
iSize >= 64) {
            
#emit LOAD.S.alt iAddress
            #emit LOAD.S.pri iValue
            #emit FILL 64
            
iSize    -= 64;
            
iAddress += 64;
        } else if (
iSize >= 16) {
            
#emit LOAD.S.alt iAddress
            #emit LOAD.S.pri iValue
            #emit FILL 16
            
iSize    -= 16;
            
iAddress += 16;
        } else {
            
#emit LOAD.S.alt iAddress
            #emit LOAD.S.pri iValue
            #emit FILL 4
            
iSize    -= 4;
            
iAddress += 4;
        }
    }
    
    
// aArray is used, just not by its symbol name
    #pragma unused aArray

What does it do?


Re: what does this function do? - dudaefj - 12.12.2013

nobody?