mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-10 22:24:33 +00:00
Merge branch 'Preview4_0' into str_cpp_memory_experiment
This commit is contained in:
commit
1e9aa8b86f
4161 changed files with 514029 additions and 215418 deletions
|
|
@ -48,8 +48,12 @@ Convert the byte ordering on the U16 to and from big/little endian format.
|
|||
|
||||
inline U16 endianSwap(const U16 in_swap)
|
||||
{
|
||||
#ifdef TORQUE_U16_ENDIANSWAP_BUILTIN
|
||||
return TORQUE_U16_ENDIANSWAP_BUILTIN(in_swap);
|
||||
#else
|
||||
return U16(((in_swap >> 8) & 0x00ff) |
|
||||
((in_swap << 8) & 0xff00));
|
||||
#endif
|
||||
}
|
||||
|
||||
inline S16 endianSwap(const S16 in_swap)
|
||||
|
|
@ -64,10 +68,14 @@ Convert the byte ordering on the U32 to and from big/little endian format.
|
|||
*/
|
||||
inline U32 endianSwap(const U32 in_swap)
|
||||
{
|
||||
#ifdef TORQUE_U32_ENDIANSWAP_BUILTIN
|
||||
return TORQUE_U32_ENDIANSWAP_BUILTIN(in_swap);
|
||||
#else
|
||||
return U32(((in_swap >> 24) & 0x000000ff) |
|
||||
((in_swap >> 8) & 0x0000ff00) |
|
||||
((in_swap << 8) & 0x00ff0000) |
|
||||
((in_swap << 24) & 0xff000000));
|
||||
#endif
|
||||
}
|
||||
|
||||
inline S32 endianSwap(const S32 in_swap)
|
||||
|
|
@ -77,12 +85,16 @@ inline S32 endianSwap(const S32 in_swap)
|
|||
|
||||
inline U64 endianSwap(const U64 in_swap)
|
||||
{
|
||||
#ifdef TORQUE_U64_ENDIANSWAP_BUILTIN
|
||||
return TORQUE_U64_ENDIANSWAP_BUILTIN(in_swap);
|
||||
#else
|
||||
U32 *inp = (U32 *) &in_swap;
|
||||
U64 ret;
|
||||
U32 *outp = (U32 *) &ret;
|
||||
outp[0] = endianSwap(inp[1]);
|
||||
outp[1] = endianSwap(inp[0]);
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
inline S64 endianSwap(const S64 in_swap)
|
||||
|
|
@ -138,4 +150,3 @@ TORQUE_DECLARE_TEMPLATIZED_ENDIAN_CONV(F32)
|
|||
TORQUE_DECLARE_TEMPLATIZED_ENDIAN_CONV(F64)
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -30,9 +30,9 @@
|
|||
namespace Torque
|
||||
{
|
||||
|
||||
extern U32 hash(register const U8 *k, register U32 length, register U32 initval);
|
||||
extern U32 hash(const U8 *k, U32 length, U32 initval);
|
||||
|
||||
extern U64 hash64(register const U8 *k, register U32 length, register U64 initval);
|
||||
extern U64 hash64(const U8 *k, U32 length, U64 initval);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -287,9 +287,9 @@ class String::StringData : protected StringDataImpl
|
|||
|
||||
static StringData* Create(const StringChar* data, U32 len, bool interned = false)
|
||||
{
|
||||
void* memory = dMalloc(sizeof(StringData) + sizeof(StringChar) * len);
|
||||
StringData* result = new(memory) StringData(data, len, interned);
|
||||
return result;
|
||||
void* memory = dMalloc(sizeof(StringData) + sizeof(StringChar) * len)
|
||||
StringData* result = new(memory) StringData(data, len, interned);
|
||||
return result;
|
||||
}
|
||||
|
||||
static StringData* Create(const StringChar* data, U32 len, DataChunker& chunker, bool interned = false)
|
||||
|
|
@ -298,7 +298,7 @@ class String::StringData : protected StringDataImpl
|
|||
StringData* result = new(memory) StringData(data, len, interned);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
bool isShared() const
|
||||
{
|
||||
return ( mRefCount > 1 );
|
||||
|
|
|
|||
|
|
@ -361,7 +361,9 @@ class StringBuilder
|
|||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
return mFormat.formatAppend(fmt, args);
|
||||
const S32 result = mFormat.formatAppend(fmt, args);
|
||||
va_end(args);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -407,8 +407,15 @@ FileNodeRef ZipFileSystem::resolve(const Path& path)
|
|||
if(mZipNameIsDir)
|
||||
{
|
||||
// Remove the fake root from the name so things can be found
|
||||
#ifdef TORQUE_ZIP_PATH_CASE_INSENSITIVE
|
||||
String lowerFakeRoot = String::ToLower(mFakeRoot);
|
||||
String lowerName = String::ToLower(name);
|
||||
if(lowerName.find(lowerFakeRoot) == 0)
|
||||
name = name.substr(mFakeRoot.length());
|
||||
#else
|
||||
if(name.find(mFakeRoot) == 0)
|
||||
name = name.substr(mFakeRoot.length());
|
||||
name = name.substr(mFakeRoot.length());
|
||||
#endif
|
||||
|
||||
#ifdef TORQUE_DISABLE_FIND_ROOT_WITHIN_ZIP
|
||||
else
|
||||
|
|
@ -480,8 +487,15 @@ FileNodeRef ZipFileSystem::resolveLoose(const Path& path)
|
|||
if(mZipNameIsDir)
|
||||
{
|
||||
// Remove the fake root from the name so things can be found
|
||||
#ifdef TORQUE_ZIP_PATH_CASE_INSENSITIVE
|
||||
String lowerFakeRoot = String::ToLower(mFakeRoot);
|
||||
String lowerName = String::ToLower(name);
|
||||
if(lowerName.find(lowerFakeRoot) == 0)
|
||||
name = name.substr(mFakeRoot.length());
|
||||
#else
|
||||
if(name.find(mFakeRoot) == 0)
|
||||
name = name.substr(mFakeRoot.length());
|
||||
name = name.substr(mFakeRoot.length());
|
||||
#endif
|
||||
|
||||
#ifdef TORQUE_DISABLE_FIND_ROOT_WITHIN_ZIP
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue