diff --git a/.gitignore b/.gitignore index 28eeec4..3fa48f6 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ obj build/ test/ shuffle3-* +profiling/ diff --git a/Makefile b/Makefile index 47fa08f..78e647d 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,8 @@ RELEASE_LDFLAGS?= -O3 -flto DEBUG_CFLAGS?= -g -O0 DEBUG_LDFLAGS?= -O0 +STRIP=strip + OBJ = $(addprefix obj/,$(SRC:.c=.o)) .PHONY: release @@ -35,7 +37,7 @@ $(BUILD)/$(PROJECT)-release: CFLAGS+= $(RELEASE_CFLAGS) $(BUILD)/$(PROJECT)-release: LDFLAGS+= $(RELEASE_LDFLAGS) $(BUILD)/$(PROJECT)-release: $(OBJ) $(CC) $^ $(CFLAGS) -o $@ $(LDFLAGS) - strip $@ + $(STRIP) $@ $(BUILD)/$(PROJECT)-debug: CFLAGS+= $(DEBUG_CFLAGS) $(BUILD)/$(PROJECT)-debug: LDFLAGS+= $(DEBUG_LDFLAGS) diff --git a/lean/Makefile b/lean/Makefile index 11b9bdc..fc78b7c 100644 --- a/lean/Makefile +++ b/lean/Makefile @@ -16,7 +16,9 @@ CXX_OPT_FLAGS?= $(OPT_FLAGS) -felide-constructors CFLAGS += $(COMMON_FLAGS) --std=gnu11 CXXFLAGS += $(COMMON_FLAGS) --std=gnu++20 -fno-exceptions -LDFLAGS += -lfmt +LDFLAGS += -lfmt + +STRIP=strip RELEASE_CFLAGS?= -O3 -flto $(OPT_FLAGS) RELEASE_CXXFLAGS?= -O3 -flto $(CXX_OPT_FLAGS) @@ -58,7 +60,7 @@ $(PROJECT)-release: CXXFLAGS += $(RELEASE_CXXFLAGS) $(PROJECT)-release: LDFLAGS += $(RELEASE_LDFLAGS) $(PROJECT)-release: $(OBJ) $(CXX) $^ $(CXXFLAGS) -o $@ $(LDFLAGS) - strip $@ + $(STRIP) $@ $(PROJECT)-debug: CFLAGS+= $(DEBUG_CFLAGS) $(PROJECT)-debug: CXXFLAGS += $(DEBUG_CXXFLAGS) diff --git a/lean/include/shuffle.hpp b/lean/include/shuffle.hpp index 099f433..289f668 100644 --- a/lean/include/shuffle.hpp +++ b/lean/include/shuffle.hpp @@ -23,7 +23,7 @@ namespace rng { inline void unshuffle(R& rng, span span) { if(!span.size()) return; - std::vector rng_values; + std::vector rng_values(span.size()); fmt::print(" -> unshuffling {} objects...", span.size()); for(std::size_t i=span.size()-1;i>0;i--) diff --git a/lean/src/main.c b/lean/src/main.c index 311a097..87f59f2 100644 --- a/lean/src/main.c +++ b/lean/src/main.c @@ -13,37 +13,9 @@ _Static_assert(sizeof(float)==sizeof(uint32_t), "float is not 32 bits"); -struct prog_args { - int argc; - char ** argv; -}; - -/* -static void shuffle_file(const char* filename) -{ - panic("unimplemented"); -} - -static void unshuffle_file(const char* filename) -{ - panic("unimplemented"); -}*/ - -//XXX: Not using this anymore -static void* map_callback(mmap_t map, void* user) -{ - struct prog_args args = *(struct prog_args*)user; - - dprintf("fd %d mapped (sz %lu) (ptr %p)\n", map.fd, map.len, map.ptr); - - - return NULL; -} - - int main(int argc, char** argv) { - struct prog_args args = {.argc = argc, .argv = argv}; + //struct prog_args args = {.argc = argc, .argv = argv}; //rng_test(); @@ -62,26 +34,3 @@ int main(int argc, char** argv) return 0; } -#ifdef _TEST -static void do_reinterpret_test() -{ - char* string = "Hello world.. how are you?????"; - size_t string_sz = strlen(string); - size_t outsz; - - uint64_t* string_as_longs = bytes_to_long((uint8_t*)string, string_sz, &outsz); - - printf("%s (%lu) -> u64 %lu\n", string, string_sz, outsz); - for (register int i=0;i f32 %lu\n", string, string_sz, outsz); - for (register int i=0;i minmax_t(const span& array, Fn keep) { T highest; T lowest; + bool init=false; for(std::size_t i=0;i highest) highest = item; }