1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-06-17 07:17:06 +01:00

Cleaning up output of CG repro

This commit is contained in:
Guido Cossu
2016-12-09 02:17:31 +00:00
parent 14a1406f54
commit 8fb0a13f39
4 changed files with 37 additions and 20 deletions

View File

@ -29,8 +29,18 @@ directory
#ifndef GRID_BITWISE_H
#define GRID_BITWISE_H
#include <cassert>
#include <bitset>
#include <climits>
#include <Config.h>
#ifdef GRID_DEFAULT_PRECISION_SINGLE
#define GRID_REAL_BYTES 4
#endif
#ifdef GRID_DEFAULT_PRECISION_DOUBLE
#define GRID_REAL_BYTES 8
#endif
namespace Grid {
@ -40,7 +50,12 @@ template <typename T>
void show_binaryrep(const T& a) {
const char* beg = reinterpret_cast<const char*>(&a);
const char* end = beg + sizeof(a);
while (beg != end) std::cout << std::bitset<CHAR_BIT>(*beg++) << ' ';
unsigned int ctr = 0;
while (beg != end) {
std::cout << std::bitset<CHAR_BIT>(*beg++) << ' ';
ctr++;
if (ctr % GRID_REAL_BYTES == 0) std::cout << '\n';
}
std::cout << '\n';
}
@ -56,4 +71,5 @@ void bitwise_xor(T& l, T& r, unsigned char* xors) {
}; // namespace
#endif