Improve COutputStream::WriteChar

This commit is contained in:
Henrique Gemignani Passos Lima 2022-10-12 19:58:24 +03:00
parent 16d013b419
commit ef751ff69f
No known key found for this signature in database
GPG Key ID: E224F951761145F8
1 changed files with 3 additions and 4 deletions

View File

@ -40,12 +40,11 @@ public:
void WriteChar(u8 c) {
FlushShiftRegister();
if (mBufLen <= mUnwrittenLen) {
if (mUnwrittenLen >= mBufLen) {
DoFlush();
}
++mNumWrites;
*(reinterpret_cast< u8* >(mBufPtr) + mUnwrittenLen) = c;
++mUnwrittenLen;
*(reinterpret_cast< u8* >(mBufPtr) + mUnwrittenLen++) = c;
}
@ -82,7 +81,7 @@ inline void coutput_stream_helper(const uint& t, COutputStream& out) {
template <>
inline void coutput_stream_helper(const bool& t, COutputStream& out) {
out.WriteChar(static_cast< char >(t));
out.WriteChar(static_cast< u8 >(t));
}
#endif // _COUTPUTSTREAM