3 Commits

Author SHA1 Message Date
boudreault.alan@gmail.com 9bc2ac3e27 Modified the linux Makefile to generate a static lib to allow external program to link with crunch 2013-01-17 18:35:56 +00:00
boudreault.alan@gmail.com 1ff067147d Fix compilation issues on linux 64 machines 2013-01-17 18:34:45 +00:00
boudreault.alan@gmail.com 0dfba013b1 Creating branch linux64 for some compilation fixes 2013-01-17 18:30:41 +00:00
4 changed files with 23 additions and 6 deletions
+10 -3
View File
@@ -1,6 +1,8 @@
COMPILE_OPTIONS = -O3 -fomit-frame-pointer -ffast-math -fno-math-errno -g -fno-strict-aliasing -Wall -Wno-unused-value -Wno-unused -march=core2
COMPILE_OPTIONS = -O3 -fomit-frame-pointer -ffast-math -fno-math-errno -g -fPIC -fno-strict-aliasing -Wall -Wno-unused-value -Wno-unused -march=core2
LINKER_OPTIONS = -lpthread -g
LIBCRUNCH = libcrunch.a
OBJECTS = \
crn_arealist.o \
crn_assert.o \
@@ -82,6 +84,9 @@ all: crunch
%.o: %.cpp
g++ $< -o $@ -c $(COMPILE_OPTIONS)
$(LIBCRUNCH): $(OBJECTS)
ar rcs $(LIBCRUNCH) $(OBJECTS)
crunch.o: ../crunch/crunch.cpp
g++ $< -o $@ -c -I../inc -I../crnlib $(COMPILE_OPTIONS)
@@ -91,6 +96,8 @@ corpus_gen.o: ../crunch/corpus_gen.cpp
corpus_test.o: ../crunch/corpus_test.cpp
g++ $< -o $@ -c -I../inc -I../crnlib $(COMPILE_OPTIONS)
crunch: $(OBJECTS) crunch.o corpus_gen.o corpus_test.o
g++ $(OBJECTS) crunch.o corpus_gen.o corpus_test.o -o crunch $(LINKER_OPTIONS)
crunch: $(LIBCRUNCH) crunch.o corpus_gen.o corpus_test.o
g++ crunch.o corpus_gen.o corpus_test.o -o crunch $(LIBCRUNCH) $(LINKER_OPTIONS)
clean:
rm -rf $(LIBCRUNCH) crunch *.o
+9
View File
@@ -56,7 +56,12 @@ namespace crnlib
template<typename T> inline T square(T value) { return value * value; }
#ifdef __GNUC__
#if CRNLIB_64BIT_POINTERS==0
inline bool is_power_of_2(uint32 x) { return x && ((x & (x - 1U)) == 0U); }
#endif
#endif
inline bool is_power_of_2(uint64 x) { return x && ((x & (x - 1U)) == 0U); }
template<typename T> inline T align_up_value(T x, uint alignment)
@@ -80,6 +85,8 @@ namespace crnlib
return align_up_value(x, alignment) - x;
}
#ifdef __GNUC__
#if CRNLIB_64BIT_POINTERS==0
// From "Hackers Delight"
inline uint32 next_pow2(uint32 val)
{
@@ -91,6 +98,8 @@ namespace crnlib
val |= val >> 1;
return val + 1;
}
#endif
#endif
inline uint64 next_pow2(uint64 val)
{
+1
View File
@@ -52,6 +52,7 @@ namespace crnlib
} // namespace crnlib
using namespace crnlib;
using crnlib::uint;
const char* crn_get_format_string(crn_format fmt)
{
+1 -1
View File
@@ -374,7 +374,7 @@ namespace crnd
const uint32 cIntBits = 32U;
#ifdef _WIN64
#if CRNLIB_64BIT_POINTERS
typedef uint64 ptr_bits;
#else
typedef uint32 ptr_bits;