// Copyright Epic Games, Inc. All Rights Reserved. #include "MuT/ASTOpConstantScalar.h" #include "HAL/PlatformMath.h" #include "MuR/ModelPrivate.h" #include "MuR/RefCounted.h" #include "MuR/Types.h" namespace mu { ASTOpConstantScalar::ASTOpConstantScalar(float InValue) { Value = InValue; } void ASTOpConstantScalar::ForEachChild(const TFunctionRef) { } bool ASTOpConstantScalar::IsEqual(const ASTOp& OtherUntyped) const { if (OtherUntyped.GetOpType() == GetOpType()) { const ASTOpConstantScalar* other = static_cast(&OtherUntyped); return Value == other->Value; } return false; } uint64 ASTOpConstantScalar::Hash() const { uint64 Result = std::hash()(uint64(GetOpType())); hash_combine(Result, Value); return Result; } mu::Ptr ASTOpConstantScalar::Clone(MapChildFuncRef) const { Ptr New = new ASTOpConstantScalar(); New->Value = Value; return New; } void ASTOpConstantScalar::Link(FProgram& Program, FLinkerOptions*) { if (!linkedAddress) { OP::ScalarConstantArgs Args; FMemory::Memzero(Args); Args.Value = Value; linkedAddress = (OP::ADDRESS)Program.OpAddress.Num(); Program.OpAddress.Add(Program.ByteCode.Num()); AppendCode(Program.ByteCode, GetOpType()); AppendCode(Program.ByteCode, Args); } } int32 ASTOpConstantScalar::EvaluateInt(ASTOpList&, bool& bOutUnknown) const { bOutUnknown = false; return Value; } }