X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/20072b367cf034ab9124560e4a06d8e32a388d93..10c0d7324d1a25feebaaf6f5bf9b6054e03dd0b3:/stglibs/sgcp.lib/include/stg/sgcp_utils.h diff --git a/stglibs/sgcp.lib/include/stg/sgcp_utils.h b/stglibs/sgcp.lib/include/stg/sgcp_utils.h deleted file mode 100644 index e5152671..00000000 --- a/stglibs/sgcp.lib/include/stg/sgcp_utils.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef __STG_SGCP_UTILS_H__ -#define __STG_SGCP_UTILS_H__ - -/* - * 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; either version 2 of the License, or - * (at your option) any later version. - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Author : Maxim Mamontov - */ - -#include "stg/os_int.h" - -#include -#include - -#include // hton* - -namespace STG -{ -namespace SGCP -{ - -template inline T hton(T value) { return value; } -template inline T ntoh(T value) { return hton(value); } - -template <> inline uint16_t hton(uint16_t value) { return htons(value); } -template <> inline int16_t hton(int16_t value) { return htons(value); } - -template <> inline uint32_t hton(uint32_t value) { return htonl(value); } -template <> inline int32_t hton(int32_t value) { return htonl(value); } - -inline -uint64_t htonll(uint64_t value) -{ -#ifdef ARCH_LE - const uint32_t high_part = htonl(static_cast(value >> 32)); - const uint32_t low_part = htonl(static_cast(value & 0xFFFFFFFFLL)); - - return (static_cast(low_part) << 32) | high_part; -#else - return value; -#endif -} - -template <> inline uint64_t hton(uint64_t value) { return htonll(value); } -template <> inline int64_t hton(int64_t value) { return htonll(value); } - -} // namespace SGCP -} // namespace STG - -#endif