Translation bitwise &

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

1 Like

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

will have to check later because code is not yet finished

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

1 Like

thanks for your reply