Commit a06100a9 authored by Raphael Kubo da Costa's avatar Raphael Kubo da Costa Committed by Commit Bot

FlexLayout: Use std::ceil() rather than std::ceilf()

This fixes the build with libstdc++ after commit 3a6cdd45 ('Improvements
in FlexLayout "stretch" cross-axis alignment handling'):

    ../../ui/views/layout/flex_layout_types_internal.cc: In member function ‘void views::internal::Span::Center(const views::internal::Span&, const views::internal::Inset1D&)’:
    ../../ui/views/layout/flex_layout_types_internal.cc:57:20: error: ‘ceilf’ is not a member of ‘std’
         set_start(std::ceilf(remaining * 0.5f));
                        ^~~~~
    ../../ui/views/layout/flex_layout_types_internal.cc:57:20: note: suggested alternative: ‘ceil’
         set_start(std::ceilf(remaining * 0.5f));
                        ^~~~~
                        ceil

ceilf() is not officially part of the C++14 standard even though libc++
exposes it. In this case, we're multiplying an int and a float, which means
we'll call ceil(float) anyway.

Bug: 819294
Change-Id: I24f16a5cd0462baef0eea07791758a3712ff2922
Reviewed-on: https://chromium-review.googlesource.com/c/1472673
Auto-Submit: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
Commit-Queue: Dana Fried <dfried@chromium.org>
Reviewed-by: default avatarDana Fried <dfried@chromium.org>
Cr-Commit-Position: refs/heads/master@{#632320}
parent 24408b58
...@@ -54,7 +54,7 @@ void Span::Center(const Span& container, const Inset1D& margins) { ...@@ -54,7 +54,7 @@ void Span::Center(const Span& container, const Inset1D& margins) {
// Case 1: no room for any margins. Just center the span in the container, // Case 1: no room for any margins. Just center the span in the container,
// with equal overflow on each side. // with equal overflow on each side.
if (remaining <= 0) { if (remaining <= 0) {
set_start(std::ceilf(remaining * 0.5f)); set_start(std::ceil(remaining * 0.5f));
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment