From 06314bcd48eab82ec6f5c5d779e56712faaf6745 Mon Sep 17 00:00:00 2001 From: Avril Date: Sat, 14 Nov 2020 18:01:04 +0000 Subject: [PATCH] improve makefile --- Makefile | 11 ++++++----- src/hex.cpp | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index ac40455..6fddd1b 100644 --- a/Makefile +++ b/Makefile @@ -46,17 +46,18 @@ pgo-generate: $(PGO_OBJ) pgo-profile: pgo-generate for i in {1..$(PGO_ITERATIONS)}; do \ - dd if=/dev/urandom of=./pgo-test bs=1024 count=$(PGO_DATASET_SIZE) >> /dev/null 2>&1; \ + dd if=/dev/urandom of=/tmp/$(PROJ)-pgo-test bs=1024 count=$(PGO_DATASET_SIZE) >> /dev/null 2>&1; \ printf "\rIteration $$i / $(PGO_ITERATIONS)"; \ - ./pgo-generate ./pgo-test > ./pgo-output; \ + ./pgo-generate /tmp/$(PROJ)-pgo-test > /tmp/$(PROJ)-pgo-output; \ done @echo "" - rm ./pgo-test - rm ./pgo-output + rm /tmp/$(PROJ)-pgo-test + rm /tmp/$(PROJ)-pgo-output rm pgo-generate -pgo-use: PROF_FLAGS = -fprofile-use -lgcov +pgo-use: PROF_FLAGS = -fprofile-use +pgo-use: LDFLAGS+= -lgcov pgo-use: $(PGO_OBJ) $(CXX) $^ $(CXXFLAGS) $(PROF_FLAGS) -o $@ $(LDFLAGS) $(PROF_FLAGS) diff --git a/src/hex.cpp b/src/hex.cpp index 5aa9911..b1bc65e 100644 --- a/src/hex.cpp +++ b/src/hex.cpp @@ -20,7 +20,7 @@ const static constexpr char ascii_map[256] = { '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', }; -constexpr const char* hex_map[256] = { +constexpr const static char* hex_map[256] = { "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "0a", "0b", "0c", "0d", "0e", "0f", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1a", "1b", "1c", "1d", "1e", "1f", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "2a", "2b", "2c", "2d", "2e", "2f", @@ -59,7 +59,7 @@ inline void hex02(std::uint8_t byte, char buffer[2]) buffer[1] =hex_map[byte][1]; } -template +template inline __attribute__((always_inline)) void print_exact(const char (&ar)[N]) { fwrite(ar, N, 1, stdout);