diff options
| author | Franklin Wei <git@fwei.tk> | 2015-05-15 18:37:00 -0400 |
|---|---|---|
| committer | Franklin Wei <git@fwei.tk> | 2015-05-15 18:37:00 -0400 |
| commit | 367c1ab04df3732d538a4761be78f66c289a78bd (patch) | |
| tree | 91bc86e06f9643fa1c3e73350e0ded0dd6dc4d99 /src/util.c | |
| parent | 42706e46a606766bb0a56d1dd727e556f4c17669 (diff) | |
| download | market-sim-367c1ab04df3732d538a4761be78f66c289a78bd.zip market-sim-367c1ab04df3732d538a4761be78f66c289a78bd.tar.gz market-sim-367c1ab04df3732d538a4761be78f66c289a78bd.tar.bz2 market-sim-367c1ab04df3732d538a4761be78f66c289a78bd.tar.xz | |
fix lots of stuff, implement history
Diffstat (limited to 'src/util.c')
| -rw-r--r-- | src/util.c | 25 |
1 files changed, 17 insertions, 8 deletions
@@ -1,6 +1,7 @@ #include "globals.h" -#include <curl/curl.h> +/* for htnos/htnol */ +#include <arpa/inet.h> void cleanup(void) { @@ -176,16 +177,24 @@ uint64_t to_sys64(uint64_t n) return to_be64(n); } -uint16_t to_sys16(uint16_t n) +uint32_t to_be32(uint32_t n) { - if(!endianness) - { - detect_endianness(); - } + return htonl(n); +} - if(endianness == BIG) - return n; +uint32_t to_sys32(uint32_t n) +{ + return ntohl(n); +} +uint16_t to_be16(uint16_t n) +{ + return htons(n); +} + +uint16_t to_sys16(uint16_t n) +{ + return ntohs(n); } struct stock_t *find_stock(struct player_t *player, char *sym) |