port/mars-tycoon
Last change
on this file since 7ef8ec4 was 80a6a52, checked in by Jonathan Neufeld <support@…>, 3 years ago |
Get to a compile state for terrain procedural generation
|
-
Property mode
set to
100755
|
File size:
732 bytes
|
Line | |
---|
1 | #include "mars_streams.h"
|
---|
2 |
|
---|
3 | #include <stdio.h>
|
---|
4 | #include <assert.h>
|
---|
5 |
|
---|
6 | namespace mars
|
---|
7 | {
|
---|
8 | ObjectStream::ObjectStream (std::iostream * pIO) : _pIn(pIO), _pOut(pIO), _traits(determineTraits())
|
---|
9 | {}
|
---|
10 |
|
---|
11 | ObjectStream::ObjectStream (std::istream * pIn) : _pIn(pIn), _traits(determineTraits())
|
---|
12 | {}
|
---|
13 |
|
---|
14 | ObjectStream::ObjectStream (std::ostream * pOut) : _pOut(pOut), _traits(determineTraits())
|
---|
15 | {}
|
---|
16 |
|
---|
17 | ObjectStream::Traits ObjectStream::determineTraits()
|
---|
18 | {
|
---|
19 | unsigned long l = 1;
|
---|
20 | Traits traits;
|
---|
21 |
|
---|
22 | // TODO: Verify endian algorithm is correct and works for memory detection, might require disk access instead
|
---|
23 | if (*reinterpret_cast< char * > (&l) & 1)
|
---|
24 | traits.endian = Traits::Little;
|
---|
25 | else
|
---|
26 | traits.endian = Traits::Big;
|
---|
27 |
|
---|
28 | return traits;
|
---|
29 | }
|
---|
30 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.