Saving as hex (reading with sscanf 2.0)
#1

I consider some giant values saving as hex.. would that optimise speed along with files and array sizes?
Main example for everyone :
Money lets say as max can be(as max amount that can be saved.. althought maybe i will use it as "unsigned" by adding 31(-1) bit int all the time)
Код:
2 147 483 647
or
Код:
7FFF FFFF
difference - 2 charaters for file and array is now free.
Reading example :
Код:
sscanf("Money 7FFFFFFF","{s}h",Player money);
Currently writing with hexadecimal...

Written with hexadecimal.. no problems found to date.
Reply
#2

Can anyone give atleast theoretical answer?
Reply
#3

I doubt there will be any noticeable difference in speed, test it if you want. File size isn't important either, 2 characters are nothing with current hard drive sizes and array sizes will be the same. Just use whatever makes the most sense, for money it would be integers.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)