Posted 09 July 2013 - 08:49 PM
I understand variables such as float, integer, byte, etc...
0A9D: readfile 0@ size 2 to 1@ //Reads 2 bytes from file into 1@
0A9D: readfile 0@ size 4 to 1@ //Reads 4 bytes from file into 1@
What I don't understand is this;
So my question; After 1@ is read from file, is 1@ 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 5@, 6@, 7@ 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
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users