folly: toLowerAscii: avoid unaligned access; also correct 3 conditions

Summary:
* folly/String.cpp (toLowerAscii): Fix two errors: the most important
would cause unaligned accesses.  This would cause a performance loss
in general, but would also result in segfaults on ARM processes.
In addition, three conditionals were wrong, further limiting
the performance of this code: switch those "<" to "<=".

Test Plan:
Run this to exercise existing tests:
fbconfig folly/test:string_test && fbmake runtests_opt
Run this to generate timing stats (before and after this change), e.g.,
fbconfig folly/test:string_benchmark && fbmake opt
_bin/folly/test/string_benchmark > TIMING-toLower-old

These numbers show a 1.6% speed increase with this change:

--- TIMING-toLower-old  2014-07-14 16:51:12.793523778 -0700
+++ TIMING-toLower-new  2014-07-14 16:49:45.815119145 -0700
@@ -1,6 +1,6 @@
============================================================================
folly/test/StringBenchmark.cpp                  relative  time/iter  iters/s
============================================================================
-libc_tolower                                                 1.06us  941.91K
-folly_toLowerAscii                                          89.99ns   11.11M
+libc_tolower                                                 1.06us  941.90K
+folly_toLowerAscii                                          88.57ns   11.29M
============================================================================

Reviewed By: brianp@fb.com

Subscribers:

FB internal diff: D1434585

Tasks: 4696800

Blame Revision: D1421056
added replaceAt and replaceAll to MutableStringPiece

Summary:
To make MutableStringPiece more usable (and make the
implementation of replace* methods easier) I made sure that
all the const methods (like find) work for MutableStringPiece
in a fashion similar to how they work with StringPiece
(work with everything auto convertible to StringPiece). As
a result this change is pretty susbstatial in LOC, even
though now much happens here.

Test Plan: unit tests

Reviewed By: marcelo.juchem@fb.com

FB internal diff: D1420965

Tasks: 4632424
reserve capacity in toAppend<StringType>(...)

Summary:
I modified the toAppend(args..., StringType* dest) so that
before appending it reserves enough space for data to be appended. It is
still work in progress (floats and doubles are really bad: we only do
very naive approximation of the size). On float like workload we gain
~10% perf, on strings/ints/chars we gain as much as 25% of perf.
Probably on bigger strings it will be even faster. We only modify the
case when toAppend() has more than 1 element to append as it would be
just overhead in case of one argument.

Test Plan:
with this change:

============================================================================
folly/test/ConvTest.cpp                         relative  time/iter
iters/s
============================================================================
preallocateTestNoFloat                                       1.59us 627.85K
preallocateTestFloat                                         1.09us 920.70K
----------------------------------------------------------------------------
============================================================================

without the change:

============================================================================
folly/test/ConvTest.cpp                         relative  time/iter
iters/s
============================================================================
preallocateTestNoFloat                                       2.12us 471.43K
preallocateTestFloat                                         1.22us 818.25K
----------------------------------------------------------------------------
============================================================================

Reviewed By: marcelo.juchem@fb.com

FB internal diff: D1420588

Tasks: 4632421
Check for self-assignment in move assignment

Summary:
Check for self-assignment in move assignment. Otherwise
Optional<Neko> cat = whatever;
cat = std::move(cat);
cat.hasValue(); // always returns false

Test Plan: fbmake runtests

Reviewed By: tjackson@fb.com

FB internal diff: D1440633
make folly::Range literal type

Summary:
7.1.5 [dcl.constexpr] / 9 (N3337) requires type to be literal to use it
in `constexpr` object declaration (seems to be not enforced by GCC 4.8?)

Currently `folly::Range<>` fails one of the requirements:

* is an aggregate type, or has at least one constexpr constructor or
constructor template that is not a copy or move constructor,

Test Plan: fbconfig folly/test:range_test && fbmake runtests_opt -j32

Reviewed By: lucian@fb.com

Subscribers: chaoyc, search-fbcode-diffs@, unicorn-diffs@

FB internal diff: D1441646

Tasks: 4720575
Bump version to 1:0