From 7d0629887a5cedc112ccb537792d5e47420722a0 Mon Sep 17 00:00:00 2001 From: Balhau Date: Sun, 2 Dec 2018 09:33:50 +0000 Subject: [PATCH] Added utils header file to group all utility code under the same utility class --- main.cpp | 20 -------------------- src/core/cpu/naive.cpp | 10 ---------- src/core/cpu/naive.hpp | 14 -------------- src/core/cpu/utils.hpp | 41 +++++++++++++++++++++++++++++++++++++++++ sse.cpp | 20 ++++++++------------ 5 files changed, 49 insertions(+), 56 deletions(-) create mode 100644 src/core/cpu/utils.hpp diff --git a/main.cpp b/main.cpp index 13a7397..3de924f 100644 --- a/main.cpp +++ b/main.cpp @@ -10,20 +10,11 @@ using namespace core::cpu; int main(int argc, char **argv) { - //Iteration over class - //blist b = blist(std::string("Tudor")); - //void *lol = b.current()->value; - - int a[avx2::AVX2_INT_SIZE] = {0x1,0x2,0x3,0x4,0x5,0x6,0x7,0x8,0x9,0xA,0xB,0xC,0xD,0xE,0xF,0x10}; - int b[avx2::AVX2_INT_SIZE] = {0x2,0x3,0x4,0x5,0x6,0x7,0x8,0x9,0xA,0xB,0xC,0xD,0xE,0xF,0x10,0x11}; - BMath bm1 = BMath(); BMath bm2; u_int64_t c1 = bm1.sum(1,2); - - char* input[1024]; std::string str=std::string(); @@ -34,17 +25,6 @@ int main(int argc, char **argv) { } - - - std::cout << "Computed stuff" << std::endl; - std::cin >> str; - - - - std::cout << "Input: " << str << std::endl; - - std::cout << "Cena1: " << c1 << std::endl; - blist list = blist(); std::cout << "List size: " << list.getSize() <>32; a[3]=a2; -}; - -void core::cpu::Naive::print(int *num, int len){ - for(int i=0;i + +using namespace::std; + +namespace core { + namespace cpu { + class Utils { + public: + //Lengths + static const unsigned char INT_LEN_64 = 2; + static const unsigned char INT_LEN_128 = 4; + static const unsigned char INT_LEN_256 = 8; + static const unsigned char INT_LEN_512 = 16; + + static const unsigned char LONG_LEN_64 = 1; + static const unsigned char LONG_LEN_128 = 2; + static const unsigned char LONG_LEN_256 = 4; + static const unsigned char LONG_LEN_512 = 8; + + //Masks + static const unsigned int MASK_32=0xFFFFFFFF; + static const unsigned int MASK_16=0xFFFF; + static const unsigned int MASK_8=0xFF; + + static void print(int* num,int len) { + for(int i=0;i