aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2015-05-14 20:35:14 -0400
committerFranklin Wei <git@fwei.tk>2015-05-14 20:35:14 -0400
commit42706e46a606766bb0a56d1dd727e556f4c17669 (patch)
tree1e2069ed5080f8623bc13f8aab82b2159887fc90 /src
parent7586aa241abb26378b7385b43d7596925b67027d (diff)
downloadmarket-sim-42706e46a606766bb0a56d1dd727e556f4c17669.zip
market-sim-42706e46a606766bb0a56d1dd727e556f4c17669.tar.gz
market-sim-42706e46a606766bb0a56d1dd727e556f4c17669.tar.bz2
market-sim-42706e46a606766bb0a56d1dd727e556f4c17669.tar.xz
fix bug
Diffstat (limited to 'src')
-rw-r--r--src/util.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/util.c b/src/util.c
index d51600a..7eea29a 100644
--- a/src/util.c
+++ b/src/util.c
@@ -154,7 +154,7 @@ uint64_t to_be64(uint64_t n)
detect_endianness();
}
- if(BIG)
+ if(endianness == LITTLE)
{
n = (n & 0x00000000FFFFFFFF) << 32 | (n & 0xFFFFFFFF00000000) >> 32;
n = (n & 0x0000FFFF0000FFFF) << 16 | (n & 0xFFFF0000FFFF0000) >> 16;
@@ -176,6 +176,18 @@ uint64_t to_sys64(uint64_t n)
return to_be64(n);
}
+uint16_t to_sys16(uint16_t n)
+{
+ if(!endianness)
+ {
+ detect_endianness();
+ }
+
+ if(endianness == BIG)
+ return n;
+
+}
+
struct stock_t *find_stock(struct player_t *player, char *sym)
{
printf("find stock %s\n", sym);