Translation bitwise &


#1

I admit I just use this bitwise & and have not much deeper understanding of it

when translating

    b = GetCursorMouseButtons();

    if( b & 8 )
    {

into a plugin I started of with:

	AmiVar arg1[1], result;

	arg1[0].type = VAR_NONE;
	AmiVar b = gSite.CallFunction("GetCursorMouseButtons", 0, arg1);

however, then what? I apparently can’t use:

if( b.val & 8)

help would be appreciated


#2

possibly I need to use (int)b.val instead of b.val

will have to check later because code is not yet finished


#3

Yes you need to cast float to int to use bit-wise operators.


#4

thanks for your reply