Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Initial commit
Signed-off-by: saq10002 <saad0105050@gmail.com>
- Loading branch information
saq10002
committed
Oct 26, 2014
1 parent
2763560
commit 78b590d
Showing
240 changed files
with
129,680 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,4 @@ | |||
*fuse* | |||
nbproject/private | |||
*.o | |||
*~* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,37 @@ | |||
CPP=g++ | |||
GTEST_DIR=./gtest-1.7.0 | |||
GTEST_LIB=$(GTEST_DIR)/gtest-all.o | |||
INCLUDES=-I $(GTEST_DIR) \ | |||
-I . \ | |||
-isystem $(GTEST_DIR)/include | |||
LIBS=$(GTEST_LIB) | |||
OPT_LEVEL=-O0 | |||
CPPFLAGS=-g -pthread -D_DEBUG=1 -w -std=c++11 $(OPT_LEVEL) $(INCLUDES) $(LIBS) | |||
|
|||
PROGRAM=dynamicbitset_test | |||
|
|||
SRC=ds.DynamicBitset.cpp \ | |||
dynamicbitset_test.cpp | |||
|
|||
OBJ=$(SRC:.cpp=.o) | |||
|
|||
|
|||
all : $(PROGRAM) | |||
|
|||
$(PROGRAM) : $(OBJ) | |||
$(CPP) $(CPPFLAGS) -o $@ $(OBJ) | |||
|
|||
%.o : %.cpp %.h | |||
$(CPP) $(CPPFLAGS) -c $< -o $@ | |||
|
|||
clean: | |||
@echo "Removing objects..." | |||
rm -f $(PROGRAM) *.o *~ | |||
|
|||
install: $(PROGRAM) | |||
cp $(PROGRAM) ../bin | |||
|
|||
ar: | |||
make clean | |||
tar -czvf ../$(PROGRAM)"(`date`)".tar.gz * | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,4 @@ | |||
Dynamic Bitset | |||
============== | |||
|
|||
This is a C++ implementation of a simple bit-array where you can get/set/flip individual bits. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,101 @@ | |||
#pragma once | |||
|
|||
|
|||
#ifdef _WIN32 | |||
//////////////// On Windows, CRT memory leak detection ///////////// | |||
|
|||
#define _CRTDBG_MAP_ALLOC | |||
#include <stdlib.h> | |||
#include <crtdbg.h> | |||
|
|||
|
|||
#ifdef _DEBUG | |||
#ifndef DBG_NEW | |||
#define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ ) | |||
#define new DBG_NEW | |||
#endif | |||
#endif // _DEBUG | |||
|
|||
// enable dumping memory leaks on Windows | |||
#define DETECT_MEM_LEAKS() \ | |||
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF) | |||
|
|||
#else // Non-Windows systems | |||
|
|||
// no support for memory leak detection on Non-Windows systems | |||
#define DETECT_MEM_LEAKS() | |||
|
|||
#endif // _WIN32 | |||
|
|||
|
|||
#include <cassert> | |||
|
|||
/*--------- Availability of Google C++ Test Framework ----------*/ | |||
|
|||
// whether using Google C++ Test Framework | |||
#ifndef GTEST | |||
#define GTEST 1 | |||
#endif | |||
// you have to include test.h when you want to test | |||
#include "test.h" | |||
|
|||
namespace yasi{ | |||
|
|||
|
|||
#define CONCAT_DETAIL(x,y) x ## y | |||
#define CONCAT(x,y) CONCAT_DETAIL(x,y) | |||
#define MAKE_UNIQUE(x) CONCAT(x, __COUNTER__ ) | |||
#define MAKE_UNIQUE2(x,y) MAKE_UNIQUE( CONCAT(x,y) ) | |||
#define MAKE_UNIQUE3(x,y, z) MAKE_UNIQUE2( CONCAT(x,y), z ) | |||
|
|||
#define FREE_SAFE(x) {if( (x) != 0 ) free(x); (x) = 0; } | |||
#define DELETE_SAFE(x) {if( (x) != 0 ) delete (x); (x) = 0; } | |||
#define FREE_SAFE(x) {if( (x) != 0 ) free(x); (x) = 0; } | |||
#define DELETE_ARR_SAFE(x) {if( (x) != 0 ) delete[] (x); (x) = 0; } | |||
#define ARR_LENGTH(x) ( sizeof( (x) )/sizeof( (x)[0] ) ) | |||
|
|||
#define IS_POW_OF_TWO(x) ( ((x) >= 1) && ( ((x) & ((x)-1)) == 0) ) | |||
|
|||
// override keyword in C++11 | |||
#if __STDC_VERSION__ == 201112L | |||
#pragma message(TO_STRING(__STDC_VERSION__)) | |||
// C++11 supported | |||
#define override override | |||
|
|||
#else | |||
#define override | |||
|
|||
#endif // C++11 support | |||
|
|||
// informative assert | |||
#define YASI_ASSERT_FAILED_STR "ASSERT FAILED" | |||
|
|||
#if _DEBUG | |||
|
|||
|
|||
#define ASSERT(condition) { \ | |||
/* print better message */ \ | |||
if(!(condition)){ \ | |||
std::cerr << YASI_ASSERT_FAILED_STR << ": " << #condition << " @ " << __FILE__ << " (" << __LINE__ << ")" << std::endl; \ | |||
} \ | |||
/* now call actual assert macro */ \ | |||
assert(condition); \ | |||
} | |||
#define ASSERTMSG(condition, msg) { \ | |||
/* print better message */ \ | |||
if(!(condition)){ \ | |||
std::cerr << YASI_ASSERT_FAILED_STR << ": " << #condition << " @ " << __FILE__ << " (" << __LINE__ << ")" << std::endl; \ | |||
std::cerr << "Message: " << msg; \ | |||
} \ | |||
/* now call actual assert macro */ \ | |||
assert(condition); \ | |||
} | |||
#else // _DEBUG | |||
#define ASSERT(condition) | |||
#define ASSERTMSG(condition, msg) | |||
|
|||
#endif | |||
|
|||
|
|||
|
|||
} // namespace yasi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,17 @@ | |||
#include "ds.DynamicBitset.h" | |||
|
|||
namespace yasi{ | |||
namespace ds{ | |||
// override for printing | |||
std::ostream& operator<< (std::ostream& out, const DynamicBitset* pK) { | |||
out << pK->toString(); | |||
return out; | |||
} | |||
std::ostream& operator<< (std::ostream& out, const DynamicBitset& k) { | |||
out << k.toString(); | |||
return out; | |||
} | |||
|
|||
} | |||
} | |||
|
Oops, something went wrong.