Bill 2 years ago
parent ed58c13dc9
commit 2687763a5f

@ -58,7 +58,7 @@ inline size_t append_bytes(const astring_view& view) noexcept {
template <class ...Types> template <class ...Types>
struct hasher { struct hasher {
template <size_t i = 0> typename std::enable_if< i == sizeof...(Types), template <size_t i = 0> typename std::enable_if< i == sizeof...(Types),
size_t>::type hashi(const std::tuple<Types...>& record) const { size_t>::type hashi(const std::tuple<Types...>&) const {
return 534235245539ULL; return 534235245539ULL;
} }

@ -16,8 +16,10 @@ void setgbuf(char* buf) {
static char* b = 0; static char* b = 0;
if (buf == 0) if (buf == 0)
gbuf = b; gbuf = b;
else else {
gbuf = buf; gbuf = buf;
b = buf;
}
} }
#ifdef __AQ__HAS__INT128__ #ifdef __AQ__HAS__INT128__
@ -246,10 +248,13 @@ std::ostream& operator<<(std::ostream& os, types::timestamp_t & v)
using std::string; using std::string;
string base62uuid(int l) { string base62uuid(int l) {
using namespace std; using namespace std;
constexpr static const char* base62alp = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; constexpr static const char* base62alp =
static mt19937_64 engine(chrono::system_clock::now().time_since_epoch().count()); "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
static mt19937_64 engine(
chrono::system_clock::now().time_since_epoch().count());
static uniform_int_distribution<uint64_t> u(0x10000, 0xfffff); static uniform_int_distribution<uint64_t> u(0x10000, 0xfffff);
uint64_t uuid = (u(engine) << 32ull) + (chrono::system_clock::now().time_since_epoch().count() & 0xffffffff); uint64_t uuid = (u(engine) << 32ull) +
(chrono::system_clock::now().time_since_epoch().count() & 0xffffffff);
//printf("%llu\n", uuid); //printf("%llu\n", uuid);
string ret; string ret;
while (uuid && l-- >= 0) { while (uuid && l-- >= 0) {

Loading…
Cancel
Save