From 7e069f7889b4bf6622ae89515e43afbd3284c30b Mon Sep 17 00:00:00 2001 From: Lee Bousfield Date: Fri, 2 Feb 2018 06:41:55 -0700 Subject: [PATCH] Fix OpenCL printstate --- rai/node/openclwork.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/rai/node/openclwork.cpp b/rai/node/openclwork.cpp index 6cb1c525..d92a7afc 100644 --- a/rai/node/openclwork.cpp +++ b/rai/node/openclwork.cpp @@ -382,12 +382,23 @@ __kernel void raiblocks_work (__global ulong * attempt, __global ulong * result_ void printstate (blake2b_state * S) { - printf ("%lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\n", S->h[0], S->h[1], S->h[2], S->h[3], S->h[4], S->h[5], S->h[6], S->h[7], S->t[0], S->t[1], S->f[0], S->f[1]); - for (int i = 0; i < 256; ++i) + std::cout << std::dec; + for (uint64_t x : { S->h[0], S->h[1], S->h[2], S->h[3], S->h[4], S->h[5], S->h[6], S->h[7], S->t[0], S->t[1], S->f[0], S->f[1] }) { - printf ("%02x", S->buf[i]); + std::cout << x << " "; } - printf (" %lu %02x\n", S->buflen, S->last_node); + std::cout << std::endl; + + std::cout << std::hex; + for (uint8_t x : S->buf) + { + // print x as an integer, not as a char + std::cout << +x; + } + std::cout + << std::dec << " " << S->buflen + << std::hex << " " << S->last_node + << std::dec << std::endl; } rai::opencl_environment::opencl_environment (bool & error_a)