gta-chaos-mod / ChaosModV

Chaos Mod for Grand Theft Auto V
https://gta5-mods.com/scripts/chaos-mod-v-beta
GNU General Public License v3.0
258 stars 95 forks source link

save a whopping 12 bytes from Color struct #3621

Closed Rylxnd closed 11 months ago

Rylxnd commented 11 months ago

how generous of us ;)

ReiDaTecnologia commented 11 months ago

image

Rylxnd commented 11 months ago

memory usage must be efficient of course ;)

ReiDaTecnologia commented 11 months ago

well yes but actually no 1mb i would understand but 12 bytes? '_'

ShufflePerson commented 11 months ago

well yes but actually no 1mb i would understand but 12 bytes? '_'

12 bytes is 12 bytes, imagine everything you can do with it.
You could for example store the number 7.9228163e+28!!

Jokes aside, even saving 12 bytes is worth it, any and all optimizations, as long as they don'truin the codebase, should be made if someone has the time.

ReiDaTecnologia commented 11 months ago

well yes but actually no 1mb i would understand but 12 bytes? '_'

12 bytes is 12 bytes, imagine everything you can do with it. You could for example store the number 7.9228163e+28!!

Jokes aside, even saving 12 bytes is worth it, any and all optimizations, as long as they don'truin the codebase, should be made if someone has the time.

Honestly i wish the modern gaming industry cared that much but they only care with money and in saving em (optimization and time is a waste of money for em, sadly)

Regynate commented 11 months ago

You could for example store the number 7.9228163e+28!!

10^(10^30.052154446) is quite a big number, I'm pretty sure you can't store it using just 12 bytes

Rylxnd commented 11 months ago

10^(10^30.052154446) is quite a big number, I'm pretty sure you can't store it using just 12 bytes

It's indeed pretty big. My calculator gives me an error when trying to do it. (Both my actual calculator and the one on my phone)

ShufflePerson commented 11 months ago

You could for example store the number 7.9228163e+28!!

10^(10^30.052154446) is quite a big number, I'm pretty sure you can't store it using just 12 bytes

12 bytes = 12*8 = 96 bits = 2^96 = 7.9228163e+28

Regynate commented 11 months ago

You could for example store the number 7.9228163e+28!!

10^(10^30.052154446) is quite a big number, I'm pretty sure you can't store it using just 12 bytes

12 bytes = 12*8 = 96 bits = 2^96 = 7.9228163e+28

7.9228163e+28!! ≈ 10^(10^30.052154446)

MoneyWasted commented 11 months ago

You could for example store the number 7.9228163e+28!!

10^(10^30.052154446) is quite a big number, I'm pretty sure you can't store it using just 12 bytes

i think he is talking about all the possible combinations of 12 bytes. that number makes more sense.

Regynate commented 11 months ago

You could for example store the number 7.9228163e+28!!

10^(10^30.052154446) is quite a big number, I'm pretty sure you can't store it using just 12 bytes

i think he is talking about all the possible combinations of 12 bytes. that number makes more sense.

No I'm not, 7.9228163e+28!! ≈ 10^(10^30.052154446)

Rylxnd commented 11 months ago

If you do the math, it does add up to 79 octillion. Which makes sense considering a 64 bit number is ≈ 15 quintillion (iirc). And 128 bits ≈ 340 undecillion.

pongo1231 commented 11 months ago

cstdint needs to be included in both headers. Also the types inside std are preferred over the ones in the global namespace (so e.g. uint8_t -> std::uint8_t).

ReiDaTecnologia commented 11 months ago

Come on guys, obviously it can store 12 cuz each byte is either 0 or 1 :p

ShufflePerson commented 11 months ago

Come on guys, obviously it can store 12 cuz each byte is either 0 or 1 :p

me when byte != bit

ReiDaTecnologia commented 11 months ago

Come on guys, obviously it can store 12 cuz each byte is either 0 or 1 :p

me when byte != bit

Ops, i forgot that bit XD

ShufflePerson commented 11 months ago

Come on guys, obviously it can store 12 cuz each byte is either 0 or 1 :p

me when byte != bit

Ops, i forgot that bit XD

LMFAO, I love that dad joke. Made me chuckle so hard