commit | df4345c7f8cd7de5a604179ca4e29324e917d76b | [log] [tgz] |
---|---|---|
author | Lei Zhang <[email protected]> | Mon Jun 15 22:07:00 2020 |
committer | Commit Bot <[email protected]> | Mon Jun 15 22:07:00 2020 |
tree | 0dbf2702cba7186d0198c7cab8a686f70ac3de3f | |
parent | e617f24ad0d39580fdc06a0f9a0872cc6c746af1 [diff] [blame] |
Fix base::IsAligned() to work with const pointers. One variant of base::IsAligned() takes a void*, but that does not work for const float*. Change the parameter type to const void*, add a unit test for it, and convert some code in media/ that can use IsAligned(). Change-Id: Iae7f8d5057dc947ebb85839a0b10e33f21ac207a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2246838 Reviewed-by: Dale Curtis <[email protected]> Reviewed-by: Brian Geffon <[email protected]> Commit-Queue: Lei Zhang <[email protected]> Cr-Commit-Position: refs/heads/master@{#778522}
diff --git a/base/memory/aligned_memory_unittest.cc b/base/memory/aligned_memory_unittest.cc index e067b4c..810f2e4 100644 --- a/base/memory/aligned_memory_unittest.cc +++ b/base/memory/aligned_memory_unittest.cc
@@ -38,6 +38,10 @@ static_cast<float*>(AlignedAlloc(8, 8))); EXPECT_TRUE(p.get()); EXPECT_TRUE(IsAligned(p.get(), 8)); + + // Make sure IsAligned() can check const pointers as well. + const float* const_p = p.get(); + EXPECT_TRUE(IsAligned(const_p, 8)); } TEST(AlignedMemoryTest, IsAligned) {