Raised This Month: $ Target: $400
 0% 

Solved What is the difference between 'ByteCountToCells' and 'char'?


Post New Thread Reply   
 
Thread Tools Display Modes
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-03-2023 , 02:27   Re: What is the difference between 'ByteCountToCells' and' char '?
Reply With Quote #11

Also of note is that Line 1438 of sc3.c is the same calculation that is performed in ByteCountToCells() except that some values are hard coded in one but not the other (which isn't really relevant since the values will never be different).
__________________

Last edited by fysiks; 11-03-2023 at 02:27.
fysiks is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-03-2023 , 21:58   Re: What is the difference between 'ByteCountToCells' and 'char'?
Reply With Quote #12

AMX-X's string natives do not support compressed strings. Just use regular arrays, as fysiks said, memory is abundant -- it's not 1995 anymore.

What exactly are you tryin to do/optimize?
__________________
Bugsy is offline
Leech_v2
Senior Member
Join Date: Mar 2011
Location: Chinese GuangDong
Old 11-04-2023 , 01:55   Re: What is the difference between 'ByteCountToCells' and' char '?
Reply With Quote #13

Quote:
Originally Posted by fysiks View Post
Also of note is that Line 1438 of sc3.c is the same calculation that is performed in ByteCountToCells() except that some values are hard coded in one but not the other (which isn't really relevant since the values will never be different).
Can you see what 'char' did to the variable (non constant)? When I was testing, the calculation result of 'char' was different from ByteCountToCells and looked irregular.
PHP Code:
new var = 255;
server_print("[AMXX]%d != %d", var char255 char);
server_print("[AMXX]%d == %d"ByteCountToCells(var), 255 char); 
Leech_v2 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-04-2023 , 21:15   Re: What is the difference between 'ByteCountToCells' and' char '?
Reply With Quote #14

Quote:
Originally Posted by Leech_v2 View Post
Can you see what 'char' did to the variable (non constant)? When I was testing, the calculation result of 'char' was different from ByteCountToCells and looked irregular.
PHP Code:
new var = 255;
server_print("[AMXX]%d != %d", var char255 char);
server_print("[AMXX]%d == %d"ByteCountToCells(var), 255 char); 
This is what I got (on Linux):

Code:
[AMXX]64 != 64
[AMXX]64 == 64
I don't have any Windows computers anymore so I can't test on Windows.

FYI, I found that a really old version of the Pawn Language Guide does have "char" documented. Might be worth taking a look: https://github.com/compuphase/pawn/b.../pawn-lang.pdf. I don't know specifically which version of Pawn they incorporated into AMX Mod X so I can't say if "char" is actually officially a feature (it doesn't appear so in the latest version).

Also, to reiterate what Bugsy said, all of this is basically a complete waste of time as there is no good reason that I can think of to use packed strings.
__________________

Last edited by fysiks; 11-04-2023 at 21:16.
fysiks 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 18:14.


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