Base type of bitwise operators
Bitwise operators have the same element and binary type.
File: OperatorBitwiseBase. js
Function OperatorBinaryBitwiseBase () {<br/> this. deriveFrom (new OperatorBinaryBase (); <br/> this. set_ClassName ("OperatorBitwiseBase"); <br/>}; </p> <p> function OperatorUnaryBitwiseBase () {<br/> this. deriveFrom (new OperatorUnaryBase (); <br/> this. set_ClassName ("OperatorUnaryBitwiseBase"); <br/>}; <br/>
Bitwise operator implementation
File: OperatorBitwise. js
Function OperatorBitwiseAnd () {<br/> this. deriveFrom (new OperatorBinaryBitwiseBase (); <br/> this. set_ClassName ("OperatorBitwiseAnd"); <br/> this. set_Sign ("&"); <br/>}; </p> <p> OperatorBitwiseAnd. prototype. evaluate = function (operands) {<br/> var values = this. _ getTwoNumberOperands (operands); </p> <p> return new OperandNumber (values [0]. get_Value () & values [1]. get_Value (); <br/>}; </p> <p> function compute AtorBitwiseOr () {<br/> this. deriveFrom (new OperatorBinaryBitwiseBase (); <br/> this. set_ClassName ("OperatorBitwiseOr"); <br/> this. set_Sign ("|"); <br/>}; </p> <p> OperatorBitwiseOr. prototype. evaluate = function (operands) {<br/> var values = this. _ getTwoNumberOperands (operands); </p> <p> return new OperandNumber (values [0]. get_Value () | values [1]. get_Value (); <br/>}; </p> <p> function OperatorBitwiseXor () {<Br/> this. deriveFrom (new OperatorBinaryBitwiseBase (); <br/> this. set_ClassName ("OperatorBitwiseXor"); <br/> this. set_Sign ("^"); <br/>}; </p> <p> OperatorBitwiseXor. prototype. evaluate = function (operands) {<br/> var value = this. _ getTwoNumberOperands (operands); </p> <p> return new OperandNumber (values [0]. get_Value () ^ values [1]. get_Value (); <br/>}; </p> <p> function OperatorBitwiseNot () {<br/> thi S. DeriveFrom (new OperatorUnaryBitwiseBase (); <br/> this. set_ClassName ("OperatorBitwiseNot"); <br/> this. set_Sign ("~ "); <Br/>}; </p> <p> OperatorBitwiseNot. prototype. evaluate = function (operands) {<br/> var val = this. getOneNumberOperand (operands); </p> <p> return new OperandNumber (~ Val. get_Value (); <br/> };