Permalink
Browse files

Got rid of several warnings due to implicit type conversions.

  • Loading branch information...
1 parent f29161a commit d7e2427a66685470d5335ba3011ce3917afb35e8 Daniel Lemire committed Jan 5, 2012
Showing with 177 additions and 116 deletions.
  1. +164 −104 headers/ewah.h
  2. +8 −7 makefile
  3. +5 −5 src/unit.cpp
View
View
@@ -1,25 +1,26 @@
VPATH = src:headers
-CXXFLAGS=-Iheaders -O2 -Wall -Wextra -Weffc++ -Wshadow -Wcast-align -Wwrite-strings -Wstrict-overflow=5 -Wpointer-arith -Winit-self
+CXXFLAGS=-Iheaders -O2 -Wall -Wextra -Weffc++ -Wconversion -Wshadow -Wcast-align -Wwrite-strings -Wstrict-overflow=5 -Wpointer-arith -Winit-self
HEADERS=ewah.h boolarray.h
+all: unit unit32bits example
-unit: $(HEADERS) unit.cpp
- g++ $(CXXFLAGS) -o unit src/unit.cpp
+unit32bits: $(HEADERS) unit.cpp
+ g++ $(CXXFLAGS) -m32 -o unit32bits src/unit.cpp
+unit: $(HEADERS) unit.cpp
+ g++ $(CXXFLAGS) -o unit src/unit.cpp
+
example: $(HEADERS) example.cpp
g++ $(CXXFLAGS) -o example example.cpp
cppcheck:
cppcheck --enable=all headers/*.h src/*.cpp *.cpp
-all:
- unit
-
doxygen:
doxygen doxyconfig.txt
package:
zip -9 EWAHBoolArray_`date +%Y-%m-%d`.zip README makefile example.cpp headers/*.h src/*.cpp
clean:
- rm -f *.o unit example
+ rm -f *.o unit example unit32bits
View
@@ -24,7 +24,7 @@ bool testRunningLengthWord() {
cout << "failed to set the running bit " << sizeof (uword) << endl;
isOk = false;
}
- for (uword myrl = 0; myrl <= RunningLengthWord<uword>::largestrunninglengthcount; myrl+=RunningLengthWord<uword>::largestrunninglengthcount/10) {
+ for (uword myrl = 0; myrl <= RunningLengthWord<uword>::largestrunninglengthcount; myrl=static_cast<uword>( myrl + RunningLengthWord<uword>::largestrunninglengthcount/10)) {
rlw.setRunningLength(myrl);
if (rlw.getRunningBit() != true) {
cout << "failed to set the running bit (2) " << sizeof (uword) << endl;
@@ -36,7 +36,7 @@ bool testRunningLengthWord() {
}
}
rlw.setRunningLength(12);
- for (uword mylw = 0; mylw <= RunningLengthWord<uword>::largestliteralcount; mylw+=RunningLengthWord<uword>::largestliteralcount/10) {
+ for (uword mylw = 0; mylw <= RunningLengthWord<uword>::largestliteralcount; mylw= static_cast<uword>(mylw+RunningLengthWord<uword>::largestliteralcount/10)) {
rlw.setNumberOfLiteralWords(mylw);
if (rlw.getRunningBit() != true) {
cout << "failed to set the running bit (3) " << sizeof (uword) << endl;
@@ -76,7 +76,7 @@ bool testEWAHBoolArrayAppend() {
bool isOk(true);
uword zero = 0;
uword specialval = 1UL + (1UL << 4)+(static_cast<uword>(1) << (sizeof(uword)*8-1));
- uword notzero = ~zero;
+ uword notzero = static_cast<uword>(~zero);
EWAHBoolArray<uword> myarray1;
BoolArray<uword> ba1;
myarray1.add(zero);
@@ -162,7 +162,7 @@ bool testJoergBukowski() {
ifstream in(indexfile.c_str(),ios::binary);
recovered.read(in);
in.close();
- vector<uint> vals;
+ vector<size_t> vals;
recovered.appendSetBits(vals);
if(vals.size()!= static_cast<size_t>(i-positions.begin()+1)) {
cout<<"failed to recover right number"<<endl;
@@ -282,7 +282,7 @@ bool testEWAHBoolArray() {
EWAHBoolArray<uword> myarray;
BoolArray<uword> ba(10 * sizeof (uword) * 8);
uword zero = 0;
- uword notzero = ~zero;
+ uword notzero = static_cast<uword>(~zero);
myarray.add(zero);
ba.setWord(0, zero);
myarray.add(zero);

0 comments on commit d7e2427

Please sign in to comment.