diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3657e18 --- /dev/null +++ b/.gitignore @@ -0,0 +1,12 @@ +bin/ +*.dis +*.o +.kdev4/ +.vscode/ +CMakeFiles/ +**/CMakeFiles/ +CMakeCache.txt +Makefile +*.cmake +build/ + diff --git a/clab/hello b/clab/hello new file mode 100755 index 0000000..9912a45 Binary files /dev/null and b/clab/hello differ diff --git a/clab/hello.c b/clab/hello.c new file mode 100644 index 0000000..4308fc2 --- /dev/null +++ b/clab/hello.c @@ -0,0 +1,5 @@ +#include + +int main(int argc,char **argv){ + printf("Hello world\n"); +} \ No newline at end of file diff --git a/clab/module.c b/clab/module.c new file mode 100644 index 0000000..78af404 --- /dev/null +++ b/clab/module.c @@ -0,0 +1,7 @@ +#include + +int hijackMethod(){ + printf("This should never be called"); + printf("Neither this..."); + return 0; +} \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..232c827 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,2 @@ + +add_subdirectory(core) \ No newline at end of file diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt new file mode 100644 index 0000000..e69de29 diff --git a/src/core/avx2.cpp b/src/core/avx2.cpp new file mode 100644 index 0000000..c1d8247 --- /dev/null +++ b/src/core/avx2.cpp @@ -0,0 +1,28 @@ +#include "avx2.h" +#include +#include + +using namespace core::cpu; + +namespace core{ + namespace cpu{ + void avx2::naive_sum(int *a,int *b){ + for(int i=0;i + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "blist.h" +#include +#include + + diff --git a/src/core/blist.h b/src/core/blist.h new file mode 100644 index 0000000..092ce79 --- /dev/null +++ b/src/core/blist.h @@ -0,0 +1,111 @@ +/* + * Copyright 2017 Vitor Fernandes + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef BLIST_H +#define BLIST_H + +#include +#include +#include + +template +class blist +{ +public: + + typedef struct node{ + node(T v,node* p,node* n){ + value = v; + next = n; + previous = p; + } + node(T v){ + value=v; + next=NULL; + previous=NULL; + } + T value; + node* next; + node* previous; + } Node; + + blist(){ + this->rootNode = NULL; + this->currentNode=this->rootNode; + size = 0; + }; + blist(T value){ + this->rootNode=new Node(value,NULL,NULL); + this->currentNode=this->rootNode; + size = 1; + }; + blist(const blist& other){ + this->rootNode = other.root(); + }; + void add(T value){ + if(this->rootNode==NULL){ + this->rootNode=new Node(value,NULL,NULL); + this->currentNode=rootNode; + }else{ + Node* newNode = new Node(value,currentNode,NULL); + this->currentNode->next = newNode; + currentNode=newNode; + } + size++; + }; + ~blist(){ + std::cout << "Destructing list" << std::endl; + Node *aux; + while(this->currentNode!=this->rootNode){ + aux = this->currentNode; + this->currentNode = this->currentNode->previous; + delete aux; + } + delete this->rootNode; + }; + blist& operator=(const blist& other){ + this->rootNode = other.root(); + }; + bool operator==(const blist& other){ + this->rootNode==other.root(); + }; + Node * root() const { + return this->rootNode; + }; + Node * current() const { + return this->currentNode; + }; + + T* values() { + T *aux = new T[size]; + Node *naux = this->rootNode; + for(int i=0;ivalue; + naux=naux->next; + } + return aux; + }; + int getSize(){ + return size; + }; +private: + Node * rootNode; + Node * currentNode; + int size; +}; + +#endif // BLIST_H diff --git a/src/core/bmath/CMakeLists.txt b/src/core/bmath/CMakeLists.txt new file mode 100644 index 0000000..e69de29 diff --git a/src/core/bmath/bmath.h b/src/core/bmath/bmath.h new file mode 100644 index 0000000..756990f --- /dev/null +++ b/src/core/bmath/bmath.h @@ -0,0 +1,27 @@ +#ifndef BALHAU_CORE_BMATH +#define BALHAU_CORE_BMATH + +#include +#include + +namespace core { + namespace bmath { + class BMath { + public: + BMath(){ + //std::cout << "Constructor BMath called" << std::endl; + } + u_int64_t sum(u_int64_t a,u_int64_t b){ + return a+b; + } + + + + ~BMath(){ + //std::cout<< "Destructor BMath called" << std::endl; + } + + }; + }; +} +#endif \ No newline at end of file diff --git a/sse.cpp b/sse.cpp new file mode 100644 index 0000000..8339866 --- /dev/null +++ b/sse.cpp @@ -0,0 +1,8 @@ +#include +#include +#include + + +int main(int argc, char** argcv){ + +} \ No newline at end of file diff --git a/time.cpp b/time.cpp new file mode 100644 index 0000000..a801003 --- /dev/null +++ b/time.cpp @@ -0,0 +1,36 @@ +#include +#include +#include + +#include +#include + +void errExit(const char *msg){ + printf("ERROR: %s",msg); + exit(1); +} + +static void displayProcessTimes(const char *msg){ + struct tms t; + clock_t clockTime; + static long clockTicks = 0; + + if(msg != NULL) + printf("%s",msg); + + if(clockTicks==0){ + clockTicks=sysconf(_SC_CLK_TCK); + + if(clockTicks==-1) errExit("sysconf"); + } + + clockTime=clock(); + if(clockTime==-1) errExit("clockTime"); + + printf("clock() returns %ld clocks-per-sec (%.2f secs)\n",(long) clockTime,(double) clockTime); +}; + +int main(int argc,char* argv[], char* env[]){ + printf("Kie kie\n"); + +} \ No newline at end of file