remove dependancy on libfmt

progress v2.0.1
Avril 4 years ago
parent c5bce05fe3
commit 66cac674a9
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -16,7 +16,7 @@ CXX_OPT_FLAGS?= $(OPT_FLAGS) -felide-constructors
CFLAGS += $(COMMON_FLAGS) --std=gnu11 CFLAGS += $(COMMON_FLAGS) --std=gnu11
CXXFLAGS += $(COMMON_FLAGS) --std=gnu++20 -fno-exceptions CXXFLAGS += $(COMMON_FLAGS) --std=gnu++20 -fno-exceptions
LDFLAGS += -lfmt LDFLAGS +=
STRIP=strip STRIP=strip

@ -3,20 +3,20 @@
#include <rng.h> #include <rng.h>
#include <reinterpret.h> #include <reinterpret.h>
#include <algorithm> #include <algorithm>
#include <fmt/format.h> #include <iostream>
namespace rng { namespace rng {
template<typename T, typename R> template<typename T, typename R>
inline void shuffle(R& rng, span<T> span) inline void shuffle(R& rng, span<T> span)
{ {
if(!span.size()) return; if(!span.size()) return;
fmt::print(" -> shuffling {} objects...", span.size()); std::cout << " -> shuffling " << span.size() << " objects...";
for(std::size_t i=span.size()-1;i>0;i--) for(std::size_t i=span.size()-1;i>0;i--)
{ {
auto j = rng.next_long(i); auto j = rng.next_long(i);
std::swap(span[i], span[j]); std::swap(span[i], span[j]);
} }
fmt::print(" OK\n"); std::cout << " OK" << std::endl;
} }
template<typename T, typename R> template<typename T, typename R>
@ -25,7 +25,7 @@ namespace rng {
if(!span.size()) return; if(!span.size()) return;
std::vector<std::size_t> rng_values(span.size()); std::vector<std::size_t> rng_values(span.size());
fmt::print(" -> unshuffling {} objects...", span.size()); std::cout << " -> unshuffling " << span.size() << " objects...";
for(std::size_t i=span.size()-1;i>0;i--) for(std::size_t i=span.size()-1;i>0;i--)
rng_values.push_back(rng.next_long(i)); rng_values.push_back(rng.next_long(i));
@ -33,6 +33,6 @@ namespace rng {
std::swap(span[i], span[rng_values.back()]); std::swap(span[i], span[rng_values.back()]);
rng_values.pop_back(); rng_values.pop_back();
} }
fmt::print(" OK\n"); std::cout << " OK" << std::endl;
} }
} }

@ -14,13 +14,6 @@ extern "C" {
#define _FORCE_INLINE __attribute__((gnu_inline)) extern inline #define _FORCE_INLINE __attribute__((gnu_inline)) extern inline
#endif #endif
/*
#ifdef DEBUG
#define dprintf(fmt, ...) printf("[dbg @" __FILE__ "->%s:%d] " fmt "\n", __func__, __LINE__ __VA_OPT__(,) __VA_ARGS__)
#else
#define dprintf(fmt, ...)
#endif
*/
extern const char* _prog_name; extern const char* _prog_name;
#ifdef __cplusplus #ifdef __cplusplus

@ -2,8 +2,6 @@
#include <functional> #include <functional>
#include <cfloat> #include <cfloat>
#include <fmt/format.h>
#include <shuffle3.h> #include <shuffle3.h>
#include <panic.h> #include <panic.h>
#include <map.h> #include <map.h>

Loading…
Cancel
Save