Posted 09 July 2013 - 08:49 PM
I understand variables such as float, integer, byte, etc...
0A9D: readfile [email protected] size 2 to [email protected] //Reads 2 bytes from file into [email protected]
0A9D: readfile [email protected] size 4 to [email protected] //Reads 4 bytes from file into [email protected]
What I don't understand is this;
So my question; After [email protected] is read from file, is [email protected] a float or an integer? How is this decided?
Posted 09 July 2013 - 09:10 PM
Posted 10 July 2013 - 12:34 AM
You will notice I went with 4 bytes on all of these, however integers values of [email protected], [email protected], [email protected] are not floats and should not require 4 bytes.
Does an integer variable in Cleo occupy 2 bytes or 4 bytes?
What are the factors that it depends upon?
Maybe I am making more out of this than I should, just trying to understand this opcode fully.
Posted 10 July 2013 - 01:34 AM
If you wrote a 4 byte integer, you should read a 4 byte intenger, but note that you can write a 1 or 2 byte integer (if it can occupy that space), and read too (CLEO will pad the other bytes...)
The float 1.0 in binary is represented as [00111111 10000000 00000000 00000000]
The integer 1065353216 has the same binary representation.
So, if you read it into a var, it will be whatever it want to be\whatever it was written as.
|Does an integer variable in Cleo occupy 2 bytes or 4 bytes?|
Posted 10 July 2013 - 07:24 AM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users