X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fmiscc.c;h=184e369b7ea7f8637d3f3831e30b381f544250d4;hb=2cd3d04c04fb347e6eea354dccf14099f56bd352;hp=b2bbbaf585fc6b082e8350228a3cee7b2405acb0;hpb=ca64d4165dd79ead16edd9a79f35e3b1cf48e557;p=flatwaifu.git diff --git a/src/miscc.c b/src/miscc.c index b2bbbaf..184e369 100644 --- a/src/miscc.c +++ b/src/miscc.c @@ -389,44 +389,3 @@ void Z_calc_time(dword t,word *h,word *m,word *s) t = t / 60; *h = t; } - -#define SWAP_VAR(a, b) do { unsigned char t = a; a = b; b = t; } while(0) - -static int16_t short2swap (int16_t x) { - union { - uint8_t a[2]; - int16_t x; - } y; - y.x = x; - SWAP_VAR(y.a[0], y.a[1]); - return y.x; -} - -static int32_t int2swap (int32_t x) { - union { - uint8_t a[4]; - int32_t x; - } y; - y.x = x; - SWAP_VAR(y.a[0], y.a[3]); - SWAP_VAR(y.a[1], y.a[2]); - return y.x; -} - -#undef SWAP_VAR - -int16_t short2host (int16_t x) { -#if __BIG_ENDIAN__ - return short2swap(x); -#else - return x; -#endif -} - -int32_t int2host (int32_t x) { -#if __BIG_ENDIAN__ - return int2swap(x); -#else - return x; -#endif -}