Skip to content

Commit 2edd2c1

Browse files
committed
Set appropriate compilation flags for perf and test Makefile targets. Fix typo in rmq_perf.cpp. Fix compilation warning due to incorrect format string specifier for 'nreq'. Human readable typedefs in types.hpp. Remove unused variable CFLAGS in Makefile.
1 parent 41061b3 commit 2edd2c1

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
CFLAGS= -W -Wall -std=c99 -pedantic $(COPT)
21
CXXFLAGS= -Wall $(COPT) -D_FILE_OFFSET_BITS=64
32
LINKFLAGS= -lm -lrt -pthread
43
INCDEPS= include/segtree.hpp include/sparsetable.hpp include/benderrmq.hpp \
@@ -17,14 +16,15 @@ endif
1716

1817
.PHONY: all clean debug test perf
1918

20-
all: CFLAGS += -O2
2119
all: CXXFLAGS += -O2
2220
all: targets
2321

24-
debug: CFLAGS += -g -DDEBUG
2522
debug: CXXFLAGS += -g -DDEBUG
2623
debug: targets
2724

25+
test: CXXFLAGS += -g -DDEBUG
26+
perf: CXXFLAGS += -O2
27+
2828
targets: lib-face
2929

3030
lib-face: src/main.cpp $(OBJDEPS) $(INCDEPS)

include/benderrmq.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ toGraphViz(BinaryTreeNode* par, BinaryTreeNode *n) {
188188
}
189189

190190
class LookupTables {
191-
vvvc_t repr;
191+
char_array_3d_t repr;
192192

193193
/* The bitmaps are stored with the LSB always set as 1 and the LSB
194194
* signifying the sign of the element at array index 0. The MSB
@@ -218,7 +218,7 @@ class LookupTables {
218218
// first. i.e. table[3][5] and NOT table[5][3]. Never
219219
// lookup with the same index on both dimenstion (for
220220
// example: table[3][3]).
221-
vvc_t table(nbits-1, vc_t(nbits, -1));
221+
char_array_2d_t table(nbits-1, vc_t(nbits, -1));
222222

223223
// Compute the lookup table for the bitmap in 'i'.
224224
for (int r = 0; r < nbits-1; ++r) {

include/types.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,9 @@ typedef std::vector<char> vc_t;
9999
typedef std::vector<vc_t> vvc_t;
100100
typedef std::vector<vvc_t> vvvc_t;
101101

102+
typedef vc_t char_array_1d_t;
103+
typedef vvc_t char_array_2d_t;
104+
typedef vvvc_t char_array_3d_t;
105+
106+
102107
#endif // LIBFACE_TYPES_HPP

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ static void handle_stats(client_t *client, parsed_url_t &url) {
664664
std::string body;
665665
char buff[2048];
666666
char *b = buff;
667-
b += sprintf(b, "Answered %llu queries\n", nreq);
667+
b += sprintf(b, "Answered %lu queries\n", nreq);
668668
b += sprintf(b, "Uptime: %s\n", get_uptime().c_str());
669669

670670
if (building) {

tests/rmq_perf.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ main() {
148148
printf("Starting Segment Tree Test\n");
149149
test_segtree(input, queries, results);
150150

151-
printf("Starting bender RMQ Test\n");
151+
printf("Starting Bender RMQ Test\n");
152152
test_benderrmq(input, queries, results);
153-
154153
}

0 commit comments

Comments
 (0)