rescrv / e Goto Github PK
View Code? Open in Web Editor NEWLibrary containing high-performance datastructures and utilities for C++
License: BSD 3-Clause "New" or "Revised" License
Library containing high-performance datastructures and utilities for C++
License: BSD 3-Clause "New" or "Revised" License
This is a library I use as a deposit for all the useful code snippets I use that make it easier to write robust applications quickly.
HyperDex contains a download to version 0.11.0 of e, but it is unclear which commit this was crafted from.
Building procedure from source
/tmp/e> make
make --no-print-directory all-am
CXX atomic.lo
In file included from atomic.cc:44:0:
e/atomic.h: In function 'void e::atomic::memory_barrier()':
e/atomic.h:87:38: error: 'exchange_32_fullbarrier' was not declared in this scope
exchange_32_fullbarrier(&x, 0);
^
e/atomic.h: In function 'uint64_t e::atomic::compare_and_swap_64_nobarrier(volatile uint64_t*, uint64_t, uint64_t)':
e/atomic.h:372:45: error: 'old_val' was not declared in this scope
return __sync_val_compare_and_swap(ptr, old_val, new_val);
^
e/atomic.h:372:54: error: 'new_val' was not declared in this scope
return __sync_val_compare_and_swap(ptr, old_val, new_val);
^
e/atomic.h: In function 'uint64_t e::atomic::exchange_64_nobarrier(volatile uint64_t*, uint64_t)':
e/atomic.h:502:56: error: 'new_val' was not declared in this scope
} while (__sync_val_compare_and_swap(ptr, old_val, new_val) != old_val);
^
make[1]: *** [atomic.lo] Error 1
make: *** [all] Error 2
/tmp/e> uname -a
Linux pc-uoi 3.13.0-40-generic #69-Ubuntu SMP Thu Nov 13 17:56:26 UTC 2014 i686 i686 i686 GNU/Linux
/tmp/e> lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.1 LTS
Release: 14.04
Codename: trusty
I re-used the slice.h/cc in a project as it was a convenient bit of code to re-use without pulling in larger dependencies.
While reading it I noticed that the compare method seems to be either trivially wrong or at least not what i would have expected...
The implementation is:
inline int
slice :: compare(const slice& rhs) const
{
if (m_sz < rhs.m_sz)
{
return -1;
}
else if (m_sz > rhs.m_sz)
{
return 1;
}
else
{
return memcmp(m_data, rhs.m_data, m_sz);
}
}
So compare()
sorts slices based on length alone, and only if they happen to be same length does it give (expected) lexicographical comparison.
As a result slice("z")
sorts before slice("aaa")
.
Is this intentional? Seems a large oversight if that class is ever used anywhere if not. If it is intentional, what is the rationale for that behaviour. I'm not sure I see how it would ever be useful...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.