-
Notifications
You must be signed in to change notification settings - Fork 14
/
common.cpp
51 lines (45 loc) · 1.08 KB
/
common.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//
// Copyright (c) 2015 – Thomson Licensing, SAS
//
// The source code form of this open source project is subject to the terms of the
// Clear BSD license.
//
// You can redistribute it and/or modify it under the terms of the Clear BSD
// License (See LICENSE file).
//
#include <iostream>
#include <iomanip>
#include <cstdint>
#include <cstdio>
#include "common.hpp"
const char* colors[] = {
"\e[0m",
"\e[1;30m",
"\e[1;31m",
};
void print_buffer(const std::uint8_t* buf, unsigned size) {
for(unsigned i = 0; i < size; ++i) {
std::cout << std::setw(3) << (unsigned) buf[i] << " ";
if(i % 16 == 15) {
std::cout << std::endl;
}
}
std::cout << std::dec << std::endl;
}
void print_m128i(__m128i reg) {
std::uint8_t freg[16];
_mm_store_si128(reinterpret_cast<__m128i*>(freg), reg);
int i;
for(i = 0; i < 16; ++i) {
printf("%d ", freg[i]);
}
printf("\n");
}
void print_uint64(std::uint64_t reg) {
std::uint8_t* freg=reinterpret_cast<std::uint8_t*>(®);
int i;
for(i = 0; i < 8; ++i) {
printf("%d ", freg[i]);
}
printf("\n");
}