View Single Post
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-22-2009 , 02:01   Re: [TUT] Packed vs Unpacked Strings
Reply With Quote #5

Quote:
Originally Posted by danielkza View Post
AMXX string functions were specially crafted to avoid the need to convert cells to chars. Doesn't converting cells to chars just to have them convert back to cells seem kinda pointless?
I know what you're getting at but packed strings can conserve memory if done correctly. You can create a single global unpacked array for a universal unpacking buffer.

It is also beneficial for having an array of bools if you choose not to use bit-fields.

PHP Code:
new g_UnpackBuffer[1024];

public 
Func1()
{
    new 
szPacked1[100 char];

    
strunpackszPacked1 g_UnpackBuffer );
}


public 
Func2()
{
    new 
szPacked2[512 char];

    
strunpackszPacked2 g_UnpackBuffer );

__________________

Last edited by Bugsy; 04-22-2009 at 02:13.
Bugsy is offline