Page MenuHomeFeedback Tracker
Feed Advanced Search

May 10 2016

ProfessorK added a comment to T82622: Bitwise Operations.

Not at all. It would have the same simplicity as the "mod" function or the "+" operator. It would first check to make sure the type of parameters passed are scalar, most likely flooring the floats before performing the appropriate bit-wise operation and spitting the result back as a float.

Perhaps at its simplest, it would look something like this:

float ArmaScriptingEngine::XOR( float firstParameter, float secondParameter )
{

return (float)( (int)firstParameter ^ (int)secondParameter );

}
I have no clue what Arma's data structures look like so this is just an example of what it may look like:

ArmaObject* ArmaScriptingEngine::XOR( const ArmaObject& firstParameter, const ArmaObject& secondParameter )
{

    if( firstParameter.getType()  != ARMATYPE_SCALAR ||
        secondParameter.getType() != ARMATYPE_SCALAR )
    {
        // Do error stuffs
        return new ArmaScalar( 0.0f );
    }

    return new ArmaScalar( float(int( ArmaCast<ArmaScalar>(firstParameter).getValue() ) ^
        int( ArmaCast<ArmaScalar>(secondParameter).getValue() )) );

}

May 10 2016, 11:10 AM · Arma 3
ProfessorK set Category to category:featurerequest on T82622: Bitwise Operations.
May 10 2016, 11:10 AM · Arma 3