Skip to content

Add LibertyCell::leakagePower overload using std::optional#218

Open
maliberty wants to merge 1 commit intoparallaxsw:masterfrom
maliberty:leakage-optional
Open

Add LibertyCell::leakagePower overload using std::optional#218
maliberty wants to merge 1 commit intoparallaxsw:masterfrom
maliberty:leakage-optional

Conversation

@maliberty
Copy link
Copy Markdown
Contributor

More modern C++ style

More modern C++ style

Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
Comment thread liberty/Liberty.cc
LibertyCell::leakagePower() const
{
std::optional<float> leakage;
if (leakage_power_exists_) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't necessarily need the leakage value to assign stuff to and simplify that a bit by directly returning the value:

{
  if (leakage_power_exists_) {
     return leakgage_power_;
  }
  return std::nullopt;
}

@hzeller
Copy link
Copy Markdown
Contributor

hzeller commented Apr 7, 2025

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants