Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some fixes in folly itself and small_vector in particular #17

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion folly/Portability.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@
#undef FOLLY_FINAL
#undef FOLLY_OVERRIDE

#ifdef __GNUC__
#if defined(__clang__)
# define FOLLY_FINAL final
# define FOLLY_OVERRIDE override
#elif defined(__GNUC__)
# #include <features.h>
# if __GNUC_PREREQ(4,7)
# define FOLLY_FINAL final
# define FOLLY_OVERRIDE override
Expand Down
10 changes: 5 additions & 5 deletions folly/small_vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ struct OneBitMutex;
//////////////////////////////////////////////////////////////////////

template<class T, std::size_t M, class A, class B, class C>
struct small_vector;
class small_vector;

//////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -205,7 +205,7 @@ namespace detail {
void populateMemForward(T* mem, std::size_t n, Function const& op) {
std::size_t idx = 0;
try {
for (int i = 0; i < n; ++i) {
for (size_t i = 0; i < n; ++i) {
op(&mem[idx]);
++idx;
}
Expand Down Expand Up @@ -414,7 +414,7 @@ namespace detail {
}
template <class T>
T* pointerFlagClear(T* p) {
return reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(p) & ~1);
return reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(p) & ~1ull);
}
inline void* shiftPointer(void* p, size_t sizeBytes) {
return static_cast<char*>(p) + sizeBytes;
Expand Down Expand Up @@ -846,14 +846,14 @@ class small_vector

reference at(size_type i) {
if (i >= size()) {
throw std::out_of_range();
throw std::out_of_range("small_vector");
}
return (*this)[i];
}

const_reference at(size_type i) const {
if (i >= size()) {
throw std::out_of_range();
throw std::out_of_range("small_vector");
}
return (*this)[i];
}
Expand Down