Fixed compile error on x86_64, see

http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=1105 for details.

git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/trunk@102 8a3a26a2-13c4-0310-b231-cf6edde360e5
This commit is contained in:
namespace 2006-09-11 10:35:17 +00:00
parent 041f7e0998
commit c22ba2604d
2 changed files with 69 additions and 0 deletions

10
CHANGES
View file

@ -1,6 +1,16 @@
This is the changelog for developers, != changelog for the end user
that we distribute with the binaries. (see changelog)
11/09/2006
namespace
- Fixed compile error on x86_64, see http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=1105
for details.
09/09/2996
namespace
- Added strafing for the camerawindow while holding ctrl
- Additional forward movement can be enabled by pressing shift during strafe
22/08/2006
SPoG
- Added VFS support for locating the archive a file was loaded from.

View file

@ -46,6 +46,17 @@ namespace TextOutputDetail
}
return ptr;
}
#if defined (_WIN64) || defined (__LP64__)
inline char* write_size_t_nonzero_decimal_backward(char* ptr, size_t decimal)
{
for (; decimal != 0; decimal /= 10)
{
*--ptr = char('0' + (size_t)(decimal % 10));
}
return ptr;
}
#endif
inline char* write_signed_nonzero_decimal_backward(char* ptr, int decimal, bool show_positive)
{
@ -71,6 +82,18 @@ namespace TextOutputDetail
}
return ptr;
}
#if defined (_WIN64) || defined (__LP64__)
inline char* write_size_t_nonzero_decimal_backward(char* ptr, size_t decimal, bool show_positive)
{
ptr = write_size_t_nonzero_decimal_backward(ptr, decimal);
if(show_positive)
{
*--ptr = '+';
}
return ptr;
}
#endif
inline char* write_signed_decimal_backward(char* ptr, int decimal, bool show_positive)
{
@ -97,6 +120,21 @@ namespace TextOutputDetail
}
return ptr;
}
#if defined (_WIN64) || defined (__LP64__)
inline char* write_size_t_decimal_backward(char* ptr, size_t decimal, bool show_positive)
{
if(decimal == 0)
{
*--ptr = '0';
}
else
{
ptr = write_size_t_nonzero_decimal_backward(ptr, decimal, show_positive);
}
return ptr;
}
#endif
}
@ -166,6 +204,27 @@ inline TextOutputStreamType& ostream_write(TextOutputStreamType& ostream, const
return ostream;
}
#if defined (_WIN64) || defined (__LP64__)
/// \brief Writes a size_t \p i to \p ostream in decimal form.
template<typename TextOutputStreamType>
inline TextOutputStreamType& ostream_write(TextOutputStreamType& ostream, const size_t i)
{
// max is 18446744073709551615, buffer of 32 chars should always be enough
const std::size_t bufferSize = 32;
#if 1
char buf[bufferSize];
char* begin = TextOutputDetail::write_size_t_decimal_backward(buf + bufferSize, i, false);
ostream.write(begin, (buf + bufferSize) - begin);
#else
char buf[bufferSize];
ostream.write(buf, snprintf(buf, bufferSize, "%u", i));
#endif
return ostream;
}
#endif
/// \brief Writes a null-terminated \p string to \p ostream.
template<typename TextOutputStreamType>
inline TextOutputStreamType& ostream_write(TextOutputStreamType& ostream, const char* string)