getARGB creates weird value

Take it easy. You learned something about binary numbers and composed numbers. They are stored together in one number to maximise the throughput of values. But you must not do calculations as a whole number. Just for fun do this:

0x00000010 - 0x00000020 = 0xfffffff0

Certainly not related to the initial colours. :slight_smile:

btw i just noticed when i just cast to int64 it works too. so i guess there still is a way to get the number to a signed int. it just has to be super huge. i think my mistake was to think that “int” without everything is the biggest kind of int and all other specifications are the more lightweight versions. that’s wrong, isn’t it?

maybe i’m also just angry because it’s 1:35am and i still haven’t got stuff done here :smiley: i’m trying to figure out code for a spirograph but i was stuck at getting a colour’s number. my brain is like “everything is terribleeeeeeeeeeeeeeeeeee”. well well… but that’s part of the fun

Yes. int is actually not specified, but instead it was supposed the int that fits into the platform. So that was 16 bit at the beginning. With the introduction of 32 bit systems, int became 32 bit. Then they found out that is a stupid idea, and from then on int was kept as 32 bit value. Now we have int (aka short int), long and long long. And with the latest standards there are int8_t, int16_t and int32_t, to be really 100% about which size they have.

It is confusing, even for the ones who invented it.

1 Like