Editor/Embedded/ValveResourceFormat/ResourceTypes/ModelFlex/FlexOps/FlexOpDiv.cs

FlexOpDiv is a small VM operation for the model flex system. It pops two floats from the FlexRuleContext stack and pushes their quotient (second popped divided by first popped).

Native Interop
#nullable enable
using System;
using System.Collections.Generic;
using System.Linq;
using HumanoidRetargeter.EditorTools.Embedded.ValveResourceFormat.Utils;
namespace HumanoidRetargeter.EditorTools.Embedded.ValveResourceFormat.ResourceTypes.ModelFlex.FlexOps;

    /// <summary>
    /// Flex operation that divides two values.
    /// </summary>
    public class FlexOpDiv : FlexOp
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="FlexOpDiv"/> class.
        /// </summary>
        public FlexOpDiv(float data) : base(data) { }

        /// <inheritdoc/>
        /// <remarks>
        /// Pops two values from the stack and pushes their quotient.
        /// </remarks>
        public override void Run(in FlexRuleContext context)
        {
            var v1 = context.Stack.Pop();
            var v2 = context.Stack.Pop();

            context.Stack.Push(v2 / v1);
        }
    }