Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/lib/byte_order.cpp
/* Copyright (C) 2010 Wildfire Games. | /* Copyright (C) 2020 Wildfire Games. | ||||
* | * | ||||
* Permission is hereby granted, free of charge, to any person obtaining | * Permission is hereby granted, free of charge, to any person obtaining | ||||
* a copy of this software and associated documentation files (the | * a copy of this software and associated documentation files (the | ||||
* "Software"), to deal in the Software without restriction, including | * "Software"), to deal in the Software without restriction, including | ||||
* without limitation the rights to use, copy, modify, merge, publish, | * without limitation the rights to use, copy, modify, merge, publish, | ||||
* distribute, sublicense, and/or sell copies of the Software, and to | * distribute, sublicense, and/or sell copies of the Software, and to | ||||
* permit persons to whom the Software is furnished to do so, subject to | * permit persons to whom the Software is furnished to do so, subject to | ||||
* the following conditions: | * the following conditions: | ||||
Show All 14 Lines | |||||
* byte order (endianness) support routines. | * byte order (endianness) support routines. | ||||
*/ | */ | ||||
#include "precompiled.h" | #include "precompiled.h" | ||||
#include "lib/byte_order.h" | #include "lib/byte_order.h" | ||||
#include "lib/bits.h" | #include "lib/bits.h" | ||||
#include <cstring> | |||||
#ifndef swap16 | #ifndef swap16 | ||||
u16 swap16(const u16 x) | u16 swap16(const u16 x) | ||||
{ | { | ||||
return (u16)(((x & 0xff) << 8) | (x >> 8)); | return (u16)(((x & 0xff) << 8) | (x >> 8)); | ||||
} | } | ||||
#endif | #endif | ||||
#ifndef swap32 | #ifndef swap32 | ||||
▲ Show 20 Lines • Show All 161 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator