diff --git a/tests/math_bench.cpp b/tests/math_bench.cpp index 195b5f5..50a8b3d 100644 --- a/tests/math_bench.cpp +++ b/tests/math_bench.cpp @@ -25,8 +25,10 @@ float mathTest(const char* _name) result += mfn(xx); } + bx::Error err; + elapsed += bx::getHPCounter(); - bx::writePrintf(writer, "%-20s: %15f\n", _name, double(elapsed) ); + bx::write(writer, &err, "%-20s: %15f\n", _name, double(elapsed) ); return result; } @@ -39,40 +41,41 @@ float rsqrt(float _a) void math_bench() { bx::WriterI* writer = bx::getStdOut(); - bx::writePrintf(writer, "Math bench\n\n"); + bx::Error err; + bx::write(writer, &err, "Math bench\n\n"); mathTest< ::sqrtf >(" ::sqrtf"); mathTest("bx::sqrtRef"); mathTest("bx::sqrtSimd"); mathTest("bx::sqrt"); - bx::writePrintf(writer, "\n"); + bx::write(writer, &err, "\n"); mathTest< ::rsqrt >(" ::rsqrtf"); mathTest("bx::rsqrtRef"); mathTest("bx::rsqrtSimd"); mathTest("bx::rsqrt"); - bx::writePrintf(writer, "\n"); + bx::write(writer, &err, "\n"); mathTest< ::sinf >(" ::sinf"); mathTest("bx::sin"); - bx::writePrintf(writer, "\n"); + bx::write(writer, &err, "\n"); mathTest< ::asinf>(" ::asinf"); mathTest("bx::asin"); - bx::writePrintf(writer, "\n"); + bx::write(writer, &err, "\n"); mathTest< ::cosf >(" ::cosf"); mathTest("bx::cos"); - bx::writePrintf(writer, "\n"); + bx::write(writer, &err, "\n"); mathTest< ::acosf>(" ::acosf"); mathTest("bx::acos"); - bx::writePrintf(writer, "\n"); + bx::write(writer, &err, "\n"); mathTest< ::tanf >(" ::tanf"); mathTest("bx::tan"); - bx::writePrintf(writer, "\n"); + bx::write(writer, &err, "\n"); mathTest< ::atanf>(" ::atanf"); mathTest("bx::atan"); } diff --git a/tools/bin2c/bin2c.cpp b/tools/bin2c/bin2c.cpp index da3d239..2c7f48d 100644 --- a/tools/bin2c/bin2c.cpp +++ b/tools/bin2c/bin2c.cpp @@ -35,8 +35,11 @@ public: const char* data = (const char*)m_mb.more(0); uint32_t size = uint32_t(bx::seek(&m_mw) ); - bx::writePrintf( + bx::Error err; + + bx::write( m_writer + , &err , "static const uint8_t %.*s[%d] =\n{\n" , m_name.getLength() , m_name.getPtr() @@ -60,7 +63,7 @@ public: if (HEX_DUMP_WIDTH == asciiPos) { ascii[asciiPos] = '\0'; - bx::writePrintf(m_writer, "\t" HEX_DUMP_FORMAT "// %s\n", hex, ascii); + bx::write(m_writer, &err, "\t" HEX_DUMP_FORMAT "// %s\n", hex, ascii); data += asciiPos; hexPos = 0; asciiPos = 0; @@ -70,11 +73,11 @@ public: if (0 != asciiPos) { ascii[asciiPos] = '\0'; - bx::writePrintf(m_writer, "\t" HEX_DUMP_FORMAT "// %s\n", hex, ascii); + bx::write(m_writer, &err, "\t" HEX_DUMP_FORMAT "// %s\n", hex, ascii); } } - bx::writePrintf(m_writer, "};\n"); + bx::write(m_writer, &err, "};\n"); #undef HEX_DUMP_WIDTH #undef HEX_DUMP_SPACE_WIDTH #undef HEX_DUMP_FORMAT @@ -88,19 +91,20 @@ public: void help(const char* _error = NULL) { bx::WriterI* stdOut = bx::getStdOut(); + bx::Error err; if (NULL != _error) { - bx::writePrintf(stdOut, "Error:\n%s\n\n", _error); + bx::write(stdOut, &err, "Error:\n%s\n\n", _error); } - bx::writePrintf(stdOut + bx::write(stdOut, &err , "bin2c, binary to C\n" "Copyright 2011-2018 Branimir Karadzic. All rights reserved.\n" "License: https://github.com/bkaradzic/bx#license-bsd-2-clause\n\n" ); - bx::writePrintf(stdOut + bx::write(stdOut, &err , "Usage: bin2c -f -o -n \n" "\n" "Options:\n"