X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fmiscc.c;h=184e369b7ea7f8637d3f3831e30b381f544250d4;hb=HEAD;hp=50f02fdf16b7d6afe30e9aa32ed60da50e33167f;hpb=dbfaa4949fe7c5be64cf3e98b1875b711656ff67;p=flatwaifu.git diff --git a/src/miscc.c b/src/miscc.c index 50f02fd..184e369 100644 --- a/src/miscc.c +++ b/src/miscc.c @@ -1,24 +1,19 @@ -/* - Copyright (C) Prikol Software 1996-1997 - Copyright (C) Aleksey Volynskov 1996-1997 - Copyright (C) 2011 - - This file is part of the Doom2D:Rembo project. - - Doom2D:Rembo is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 as - published by the Free Software Foundation. - - Doom2D:Rembo is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see or - write to the Free Software Foundation, Inc., - 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ +/* Copyright (C) 1996-1997 Aleksey Volynskov + * Copyright (C) 2011 Rambo + * Copyright (C) 2020 SovietPony + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3 of the License ONLY. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "glob.h" #include @@ -394,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 -}