the astar demo sample program

BlitzMax Forums/BlitzMax Beginners Area/the astar demo sample program

yossi(Posted 2014) [#1]
I learn blitz max by looking the samples come with blitz max.
right now I learn the astar demo program.

I have a problem to understand the next command in the loadmap method that belong to the astardemo type that locate in the astar_demo.bmx file:
Local stream:TStream = ReadStream("littleendian::map"+mapNumber)

I cant find what is "littleendian::map" and where it is defined ?


GfK(Posted 2014) [#2]
Well, "map" is the first part of the filename.

About Little Endian...

Long version:
I don't normally (i.e. ever) bother myself with endianness as I've simply never needed to, so I'm not exactly 100% clued up on the intricacies of it. But the gist of the idea is that by using Little Endian (or Big Endian - I can never remember which is which) lets you store the least significant bit/byte either first, or last.

"littleendian::" just tells ReadStream to use little endian protocol when reading data.

Short version:
Don't worry about it.


dawlane(Posted 2014) [#3]
See http://en.wikipedia.org/wiki/Endianness a description on Big and Little endian.
In general it is the order of how a number/address can be written/stored.
For example using decimal (base 10): units,10s,100's,1000's (little endian) or 1000's,100's,10's,units (big end endian).
Which version is used depends on the CPU. You should read about how a number is stored in binary (base 2). Numbers can be represented in 3 ways integer, floating point and Binary-Code Decimal. You will also see that there is a relationship between hexadecimal (base 16) numbers and binary.


yossi(Posted 2014) [#4]
thank you for replying.
it was very helpful.