Added gitignore
This commit is contained in:
parent
f3b28c040c
commit
11378e5ea6
14 changed files with 277 additions and 0 deletions
12
.gitignore
vendored
Normal file
12
.gitignore
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
bin/
|
||||||
|
*.dis
|
||||||
|
*.o
|
||||||
|
.kdev4/
|
||||||
|
.vscode/
|
||||||
|
CMakeFiles/
|
||||||
|
**/CMakeFiles/
|
||||||
|
CMakeCache.txt
|
||||||
|
Makefile
|
||||||
|
*.cmake
|
||||||
|
build/
|
||||||
|
|
BIN
clab/hello
Executable file
BIN
clab/hello
Executable file
Binary file not shown.
5
clab/hello.c
Normal file
5
clab/hello.c
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(int argc,char **argv){
|
||||||
|
printf("Hello world\n");
|
||||||
|
}
|
7
clab/module.c
Normal file
7
clab/module.c
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int hijackMethod(){
|
||||||
|
printf("This should never be called");
|
||||||
|
printf("Neither this...");
|
||||||
|
return 0;
|
||||||
|
}
|
2
src/CMakeLists.txt
Normal file
2
src/CMakeLists.txt
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
|
||||||
|
add_subdirectory(core)
|
0
src/core/CMakeLists.txt
Normal file
0
src/core/CMakeLists.txt
Normal file
28
src/core/avx2.cpp
Normal file
28
src/core/avx2.cpp
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#include "avx2.h"
|
||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
using namespace core::cpu;
|
||||||
|
|
||||||
|
namespace core{
|
||||||
|
namespace cpu{
|
||||||
|
void avx2::naive_sum(int *a,int *b){
|
||||||
|
for(int i=0;i<avx2::AVX2_INT_SIZE;i++){
|
||||||
|
a[i] = a[i]+b[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void avx2::avx_sum(int *a,int *b){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void avx2::printAVX2Num(int *num){
|
||||||
|
for(int i=0;i<avx2::AVX2_INT_SIZE;i++){
|
||||||
|
cout << i;
|
||||||
|
if(i<avx2::AVX2_INT_SIZE-1){
|
||||||
|
cout << ",";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
19
src/core/avx2.h
Normal file
19
src/core/avx2.h
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
#ifndef AVX2_H
|
||||||
|
#define AVX2_H
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
/**
|
||||||
|
* This will define a set of functions
|
||||||
|
*/
|
||||||
|
namespace core {
|
||||||
|
namespace cpu {
|
||||||
|
class avx2 {
|
||||||
|
public:
|
||||||
|
static void inline naive_sum(int* a, int* b);
|
||||||
|
static void inline avx_sum(int* a, int* b);
|
||||||
|
static int const AVX2_INT_SIZE=16;
|
||||||
|
static void printAVX2Num(int* num);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
#endif
|
22
src/core/blist.cpp
Normal file
22
src/core/blist.cpp
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2017 Vitor Fernandes <email>
|
||||||
|
*
|
||||||
|
* 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 <iostream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
|
111
src/core/blist.h
Normal file
111
src/core/blist.h
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2017 Vitor Fernandes <email>
|
||||||
|
*
|
||||||
|
* 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 <string>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
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<T>& 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<T>& 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;i<size;i++){
|
||||||
|
aux[i]=naux->value;
|
||||||
|
naux=naux->next;
|
||||||
|
}
|
||||||
|
return aux;
|
||||||
|
};
|
||||||
|
int getSize(){
|
||||||
|
return size;
|
||||||
|
};
|
||||||
|
private:
|
||||||
|
Node * rootNode;
|
||||||
|
Node * currentNode;
|
||||||
|
int size;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // BLIST_H
|
0
src/core/bmath/CMakeLists.txt
Normal file
0
src/core/bmath/CMakeLists.txt
Normal file
27
src/core/bmath/bmath.h
Normal file
27
src/core/bmath/bmath.h
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
#ifndef BALHAU_CORE_BMATH
|
||||||
|
#define BALHAU_CORE_BMATH
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
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
|
8
sse.cpp
Normal file
8
sse.cpp
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char** argcv){
|
||||||
|
|
||||||
|
}
|
36
time.cpp
Normal file
36
time.cpp
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
#include <sys/times.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
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");
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue