proxygen
folly::fbstring_detail Namespace Reference

Functions

template<class InIt , class OutIt >
std::pair< InIt, OutIt > copy_n (InIt b, typename std::iterator_traits< InIt >::difference_type n, OutIt d)
 
template<class Pod , class T >
void podFill (Pod *b, Pod *e, T c)
 
template<class Pod >
void podCopy (const Pod *b, const Pod *e, Pod *d)
 
template<class Pod >
void podMove (const Pod *b, const Pod *e, Pod *d)
 
void assume_unreachable ()
 

Function Documentation

void folly::fbstring_detail::assume_unreachable ( )
inline

Definition at line 202 of file FBString.h.

Referenced by folly::fbstring_core< char >::fbstring_core(), folly::small_vector< Observer< T > *, InlineObservers >::makeSize(), folly::detail::IntegralSizePolicy< SizeType, false >::moveToUninitialized(), folly::detail::IntegralSizePolicy< SizeType, false >::moveToUninitializedEmplace(), folly::fbstring_core< char >::mutableData(), and folly::fbstring_core< char >::reserve().

202  {
203 #if defined(__GNUC__) // Clang also defines __GNUC__
204  __builtin_unreachable();
205 #elif defined(_MSC_VER)
206  __assume(0);
207 #else
208  // Well, it's better than nothing.
209  std::abort();
210 #endif
211 }
template<class InIt , class OutIt >
std::pair<InIt, OutIt> folly::fbstring_detail::copy_n ( InIt  b,
typename std::iterator_traits< InIt >::difference_type  n,
OutIt  d 
)
inline

Definition at line 130 of file FBString.h.

References b.

Referenced by folly::small_vector< Observer< T > *, InlineObservers >::insertImpl(), and folly::basic_fbstring< E, T, A, Storage >::replaceImpl().

133  {
134  for (; n != 0; --n, ++b, ++d) {
135  *d = *b;
136  }
137  return std::make_pair(b, d);
138 }
char b
template<class Pod >
void folly::fbstring_detail::podCopy ( const Pod *  b,
const Pod *  e,
Pod *  d 
)
inline
template<class Pod , class T >
void folly::fbstring_detail::podFill ( Pod *  b,
Pod *  e,
T  c 
)
inline

Definition at line 141 of file FBString.h.

References b, c, FBSTRING_ASSERT, and T.

Referenced by folly::basic_fbstring< E, T, A, Storage >::append(), folly::basic_fbstring< char >::basic_fbstring(), folly::basic_fbstring< E, T, A, Storage >::insertImplDiscr(), and folly::basic_fbstring< E, T, A, Storage >::resize().

141  {
142  FBSTRING_ASSERT(b && e && b <= e);
143  constexpr auto kUseMemset = sizeof(T) == 1;
144  if /* constexpr */ (kUseMemset) {
145  memset(b, c, size_t(e - b));
146  } else {
147  auto const ee = b + ((e - b) & ~7u);
148  for (; b != ee; b += 8) {
149  b[0] = c;
150  b[1] = c;
151  b[2] = c;
152  b[3] = c;
153  b[4] = c;
154  b[5] = c;
155  b[6] = c;
156  b[7] = c;
157  }
158  // Leftovers
159  for (; b != e; ++b) {
160  *b = c;
161  }
162  }
163 }
#define T(v)
Definition: http_parser.c:233
char b
#define FBSTRING_ASSERT(expr)
Definition: FBString.h:64
char c
template<class Pod >
void folly::fbstring_detail::podMove ( const Pod *  b,
const Pod *  e,
Pod *  d 
)
inline