Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
SkSL::CoercionCost Struct Reference

#include <SkSLType.h>

Public Member Functions

bool isPossible (bool allowNarrowing) const
 
CoercionCost operator+ (CoercionCost rhs) const
 
bool operator< (CoercionCost rhs) const
 
bool operator<= (CoercionCost rhs) const
 

Static Public Member Functions

static CoercionCost Free ()
 
static CoercionCost Normal (int cost)
 
static CoercionCost Narrowing (int cost)
 
static CoercionCost Impossible ()
 

Public Attributes

int fNormalCost
 
int fNarrowingCost
 
bool fImpossible
 

Detailed Description

Definition at line 38 of file SkSLType.h.

Member Function Documentation

◆ Free()

static CoercionCost SkSL::CoercionCost::Free ( )
inlinestatic

Definition at line 39 of file SkSLType.h.

39{ return { 0, 0, false }; }

◆ Impossible()

static CoercionCost SkSL::CoercionCost::Impossible ( )
inlinestatic

Definition at line 42 of file SkSLType.h.

42{ return { 0, 0, true }; }

◆ isPossible()

bool SkSL::CoercionCost::isPossible ( bool  allowNarrowing) const
inline

Definition at line 44 of file SkSLType.h.

44 {
45 return !fImpossible && (fNarrowingCost == 0 || allowNarrowing);
46 }

◆ Narrowing()

static CoercionCost SkSL::CoercionCost::Narrowing ( int  cost)
inlinestatic

Definition at line 41 of file SkSLType.h.

41{ return { 0, cost, false }; }

◆ Normal()

static CoercionCost SkSL::CoercionCost::Normal ( int  cost)
inlinestatic

Definition at line 40 of file SkSLType.h.

40{ return { cost, 0, false }; }

◆ operator+()

CoercionCost SkSL::CoercionCost::operator+ ( CoercionCost  rhs) const
inline

Definition at line 49 of file SkSLType.h.

49 {
50 if (fImpossible || rhs.fImpossible) {
51 return Impossible();
52 }
53 return { fNormalCost + rhs.fNormalCost, fNarrowingCost + rhs.fNarrowingCost, false };
54 }
static CoercionCost Impossible()
Definition SkSLType.h:42

◆ operator<()

bool SkSL::CoercionCost::operator< ( CoercionCost  rhs) const
inline

Definition at line 56 of file SkSLType.h.

56 {
57 return std::tie( fImpossible, fNarrowingCost, fNormalCost) <
58 std::tie(rhs.fImpossible, rhs.fNarrowingCost, rhs.fNormalCost);
59 }

◆ operator<=()

bool SkSL::CoercionCost::operator<= ( CoercionCost  rhs) const
inline

Definition at line 61 of file SkSLType.h.

61 {
62 return std::tie( fImpossible, fNarrowingCost, fNormalCost) <=
63 std::tie(rhs.fImpossible, rhs.fNarrowingCost, rhs.fNormalCost);
64 }

Member Data Documentation

◆ fImpossible

bool SkSL::CoercionCost::fImpossible

Definition at line 68 of file SkSLType.h.

◆ fNarrowingCost

int SkSL::CoercionCost::fNarrowingCost

Definition at line 67 of file SkSLType.h.

◆ fNormalCost

int SkSL::CoercionCost::fNormalCost

Definition at line 66 of file SkSLType.h.


The documentation for this struct was generated from the following file: