Blender V5.3
bsl::ConstexprValue Struct Reference

#include <constexpr.hh>

Public Types

enum  CompType { BOOL = 0x00 , UINT = 0x10 , INT = 0x20 , FLOAT = 0x30 }
enum  Type {
  INVALID = 0 , BOOL1 = CompType::BOOL | 0x01 , BOOL2 = CompType::BOOL | 0x02 , BOOL3 = CompType::BOOL | 0x03 ,
  BOOL4 = CompType::BOOL | 0x04 , UINT1 = CompType::UINT | 0x11 , UINT2 = CompType::UINT | 0x12 , UINT3 = CompType::UINT | 0x13 ,
  UINT4 = CompType::UINT | 0x14 , INT1 = CompType::INT | 0x21 , INT2 = CompType::INT | 0x22 , INT3 = CompType::INT | 0x23 ,
  INT4 = CompType::INT | 0x24 , FLOAT1 = CompType::FLOAT | 0x31 , FLOAT2 = CompType::FLOAT | 0x32 , FLOAT3 = CompType::FLOAT | 0x33 ,
  FLOAT4 = CompType::FLOAT | 0x34
}

Public Member Functions

bool is_array () const
bool is_scalar () const
int comp_len () const
CompType comp_type () const
void convert_or_broadcast (Type dst, std::vector< uint32_t > &r) const
uint32_t convert_scalar (CompType dst_comp) const
 ConstexprValue (int32_t s)
 ConstexprValue (uint32_t s)
 ConstexprValue (bool s)
 ConstexprValue (float s)
 ConstexprValue (Type t, const ConstexprValue &x)
 ConstexprValue (Type t, const ConstexprValue &x, const ConstexprValue &y)
 ConstexprValue (Type t, const ConstexprValue &x, const ConstexprValue &y, const ConstexprValue &z)
 ConstexprValue (Type t, const ConstexprValue &x, const ConstexprValue &y, const ConstexprValue &z, const ConstexprValue &w)
ConstexprValue operator+ () const
ConstexprValue operator- () const
ConstexprValue operator~ () const
ConstexprValue operator! () const
ConstexprValue & operator++ ()
ConstexprValue & operator-- ()
ConstexprValue operator++ (int)
ConstexprValue operator-- (int)
 COMPOUND_ASSIGN (%=, cast_to_int_if_not_uint(l) % cast_to_int_if_not_uint(r)) COMPOUND_ASSIGN(&
 cast_to_int_if_not_uint (l) &cast_to_int_if_not_uint(r)) COMPOUND_ASSIGN(|
 cast_to_int_if_not_uint (l)|cast_to_int_if_not_uint(r)) COMPOUND_ASSIGN(^
 cast_to_int_if_not_uint (l) ^ cast_to_int_if_not_uint(r)) COMPOUND_ASSIGN(<<
 cast_to_int_if_not_uint (l)<< cast_to_int_if_not_uint(r)) COMPOUND_ASSIGN(> >
 cast_to_int_if_not_uint (l) > > cast_to_int_if_not_uint(r)) const uint32_t &comp_raw(int i) const
uint32_t & comp_raw (int i)
template<typename T>
T comp_as (int i) const
template<typename T>
void set_as (int i, T v)
template<typename T>
T comp_cast (int i) const

Static Public Member Functions

static uint32_t cast_value (CompType from, CompType to, uint32_t value)
template<typename Func>
static ConstexprValue constexpr_op (const Func &fn, const ConstexprValue &lhs, const ConstexprValue &rhs, const bool is_bool_result=false, const bool use_left_type=false)
template<typename T>
static constexpr auto cast_to_int_if_not_uint (T val)

Public Attributes

enum bsl::ConstexprValue::Type type_ = INVALID
std::vector< uint32_t > values = {0}

Detailed Description

Container for the value of a constexpr.

Note that we do not support smaller types (e.g. char, ushort, ...) because they might not exist in the target language. Supporting them would mean having potentially 2 different result for the same expression depending on whether or not it is constexpr.

Definition at line 25 of file constexpr.hh.

Member Enumeration Documentation

◆ CompType

Enumerator
BOOL 
UINT 
INT 
FLOAT 

Definition at line 26 of file constexpr.hh.

◆ Type

Enumerator
INVALID 
BOOL1 
BOOL2 
BOOL3 
BOOL4 
UINT1 
UINT2 
UINT3 
UINT4 
INT1 
INT2 
INT3 
INT4 
FLOAT1 
FLOAT2 
FLOAT3 
FLOAT4 

Definition at line 33 of file constexpr.hh.

Constructor & Destructor Documentation

◆ ConstexprValue() [1/8]

◆ ConstexprValue() [2/8]

bsl::ConstexprValue::ConstexprValue ( uint32_t s)
inlineexplicit

Definition at line 140 of file constexpr.hh.

References type_, UINT1, and values.

◆ ConstexprValue() [3/8]

bsl::ConstexprValue::ConstexprValue ( bool s)
inlineexplicit

Definition at line 141 of file constexpr.hh.

References BOOL1, type_, and values.

◆ ConstexprValue() [4/8]

bsl::ConstexprValue::ConstexprValue ( float s)
inlineexplicit

Definition at line 142 of file constexpr.hh.

References FLOAT1, type_, and values.

◆ ConstexprValue() [5/8]

bsl::ConstexprValue::ConstexprValue ( Type t,
const ConstexprValue & x )
inlineexplicit

Definition at line 144 of file constexpr.hh.

References ConstexprValue(), type_, values, and x.

◆ ConstexprValue() [6/8]

bsl::ConstexprValue::ConstexprValue ( Type t,
const ConstexprValue & x,
const ConstexprValue & y )
inlineexplicit

Definition at line 149 of file constexpr.hh.

References comp_type(), ConstexprValue(), type_, values, x, and y.

◆ ConstexprValue() [7/8]

bsl::ConstexprValue::ConstexprValue ( Type t,
const ConstexprValue & x,
const ConstexprValue & y,
const ConstexprValue & z )
inlineexplicit

Definition at line 154 of file constexpr.hh.

References comp_type(), ConstexprValue(), type_, values, x, y, and z().

◆ ConstexprValue() [8/8]

bsl::ConstexprValue::ConstexprValue ( Type t,
const ConstexprValue & x,
const ConstexprValue & y,
const ConstexprValue & z,
const ConstexprValue & w )
inlineexplicit

Definition at line 165 of file constexpr.hh.

References comp_type(), ConstexprValue(), type_, values, w(), x, y, and z().

Member Function Documentation

◆ cast_to_int_if_not_uint() [1/6]

◆ cast_to_int_if_not_uint() [2/6]

bsl::ConstexprValue::cast_to_int_if_not_uint ( l ) const &
inline

Definition at line 249 of file constexpr.hh.

References cast_to_int_if_not_uint(), comp_raw(), COMPOUND_ASSIGN(), and values.

◆ cast_to_int_if_not_uint() [3/6]

bsl::ConstexprValue::cast_to_int_if_not_uint ( l )

◆ cast_to_int_if_not_uint() [4/6]

bsl::ConstexprValue::cast_to_int_if_not_uint ( l )

◆ cast_to_int_if_not_uint() [5/6]

bsl::ConstexprValue::cast_to_int_if_not_uint ( l )

◆ cast_to_int_if_not_uint() [6/6]

template<typename T>
constexpr auto bsl::ConstexprValue::cast_to_int_if_not_uint ( T val)
inlinestaticconstexpr

Definition at line 387 of file constexpr.hh.

References T.

◆ cast_value()

uint32_t bsl::ConstexprValue::cast_value ( CompType from,
CompType to,
uint32_t value )
inlinestatic

Definition at line 73 of file constexpr.hh.

References BOOL, FLOAT, INT, and UINT.

Referenced by convert_or_broadcast(), and convert_scalar().

◆ comp_as()

template<typename T>
T bsl::ConstexprValue::comp_as ( int i) const
inline

Definition at line 262 of file constexpr.hh.

References comp_raw(), and T.

Referenced by constexpr_op(), and bsl::ExpressionTypeParser::ternary().

◆ comp_cast()

template<typename T>
T bsl::ConstexprValue::comp_cast ( int i) const
inline

◆ comp_len()

int bsl::ConstexprValue::comp_len ( ) const
inline

Definition at line 63 of file constexpr.hh.

References type_.

Referenced by constexpr_op(), convert_or_broadcast(), is_array(), and is_scalar().

◆ comp_raw()

uint32_t & bsl::ConstexprValue::comp_raw ( int i)
inline

Definition at line 257 of file constexpr.hh.

References values.

Referenced by cast_to_int_if_not_uint(), comp_as(), comp_cast(), and set_as().

◆ comp_type()

CompType bsl::ConstexprValue::comp_type ( ) const
inline

◆ COMPOUND_ASSIGN()

◆ constexpr_op()

◆ convert_or_broadcast()

void bsl::ConstexprValue::convert_or_broadcast ( Type dst,
std::vector< uint32_t > & r ) const
inline

Definition at line 93 of file constexpr.hh.

References cast_value(), comp_len(), comp_type(), is_array(), is_scalar(), and values.

◆ convert_scalar()

uint32_t bsl::ConstexprValue::convert_scalar ( CompType dst_comp) const
inline

◆ is_array()

bool bsl::ConstexprValue::is_array ( ) const
inline

Definition at line 53 of file constexpr.hh.

References comp_len(), and values.

Referenced by constexpr_op(), convert_or_broadcast(), and convert_scalar().

◆ is_scalar()

bool bsl::ConstexprValue::is_scalar ( ) const
inline

Definition at line 58 of file constexpr.hh.

References comp_len().

Referenced by constexpr_op(), convert_or_broadcast(), and convert_scalar().

◆ operator!()

ConstexprValue bsl::ConstexprValue::operator! ( ) const
inline

Definition at line 195 of file constexpr.hh.

References constexpr_op(), and ConstexprValue().

◆ operator+()

ConstexprValue bsl::ConstexprValue::operator+ ( ) const
inline

Definition at line 180 of file constexpr.hh.

References ConstexprValue().

◆ operator++() [1/2]

ConstexprValue & bsl::ConstexprValue::operator++ ( )
inline

Definition at line 202 of file constexpr.hh.

References ConstexprValue(), and values.

◆ operator++() [2/2]

ConstexprValue bsl::ConstexprValue::operator++ ( int )
inline

Definition at line 217 of file constexpr.hh.

References ConstexprValue().

◆ operator-()

ConstexprValue bsl::ConstexprValue::operator- ( ) const
inline

Definition at line 185 of file constexpr.hh.

References constexpr_op(), and ConstexprValue().

◆ operator--() [1/2]

ConstexprValue & bsl::ConstexprValue::operator-- ( )
inline

Definition at line 209 of file constexpr.hh.

References ConstexprValue(), and values.

◆ operator--() [2/2]

ConstexprValue bsl::ConstexprValue::operator-- ( int )
inline

Definition at line 223 of file constexpr.hh.

References ConstexprValue().

◆ operator~()

ConstexprValue bsl::ConstexprValue::operator~ ( ) const
inline

Definition at line 190 of file constexpr.hh.

References constexpr_op(), and ConstexprValue().

◆ set_as()

template<typename T>
void bsl::ConstexprValue::set_as ( int i,
T v )
inline

Definition at line 267 of file constexpr.hh.

References comp_raw(), and T.

Referenced by constexpr_op().

Member Data Documentation

◆ type_

◆ values


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