Cherry-pick crrev.com/350033 to avoid misaligned access.

Avoid misaligned read/write on little endian platforms

Asan build with -fsanitize=alignment flag crash on
out/Debug/base_unittests --gtest_filter=Base*

Code does not use memcpy for consistency with code around.

BUG=chromium:1017267
BUG=chromium:1015098

TEST=pre-cq passes

Change-Id: Ie5c1d60204967c117e6b6ac2d9bd06c6fd7c1b50
Reviewed-on: https://chromium-review.googlesource.com/1877433
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Commit-Ready: Manoj Gupta <manojgupta@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Eric Caruso <ejcaruso@chromium.org>
Reviewed-by: Luis Lozano <llozano@chromium.org>
2 files changed