Raised This Month: $ Target: $400
 0% 

Load reference value before pass as vararg


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kailo
Senior Member
Join Date: Sep 2014
Location: Moscow, Russia
Old 03-29-2017 , 08:21   Load reference value before pass as vararg
Reply With Quote #1

I have byte array
PHP Code:
char g_array[4]; 
I want to do
PHP Code:
Format(buffermaxlength"%i %i %i %i"g_array[0], g_array[1], g_array[2], g_array[3]); 
Arguments pass as address with offset, but i want to load values before pass.
I need method without any additions besides reading value from memory and creating heap for passing.
Of course i can use addition function
PHP Code:
int LODB(char byte)
{
    return 
byte;
}
// or
int LODB(const char[] byte)
{
    return 
byte[0];
}
Format(buffermaxlength"%i %i %i %i"LODB(g_array[0]), LODB(g_array[1]), LODB(g_array[2]), LODB(g_array[3])); 
Or force to load value for empty operation
PHP Code:
Format(buffermaxlength"%i %i %i %i"g_array[0] + 0g_array[1] + 0g_array[2] + 0g_array[3] + 0);
Format(buffermaxlength"%i %i %i %i"g_array[0] * 1g_array[1] * 1g_array[2] * 1g_array[3] * 1);
Format(buffermaxlength"%i %i %i %i"g_array[0] & -1g_array[1] & -1g_array[2] & -1g_array[3] & -1);
// etc. 
but all of this add addtions operations besides byte loading =(
Is it not possible without dereferencing?

Last edited by Kailo; 03-29-2017 at 08:23.
Kailo is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 03-29-2017 , 08:58   Re: Load reference value before pass as vararg
Reply With Quote #2

http://xyproblem.info/
__________________
asherkin is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:04.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode