Bit-tweaking in Javascript -


Just curious I did a program in C, in which there was considerable amount of bitware operations for a variable, for a page Defines access control. I want to be able to do this in javascript itself. How can I complete this examination?

Javascript will help in bit-twisting, remember that there is no costly work.

Javascript is a general classification of BTWire operators, | , and , ~ , etc.;

The following sections will be especially useful:

  • Segment 11.4.8: beat wise NOT ( ~ )
  • stream 11.7: Bitsift shift operator ( < and > )
  • Section 11.10: Binary bitave operator ( | and & amp; )

    Note that JavaScript numbers are all floating points (Section 8.5, number type See), but bitwise functions are defined in the context of integers. For example, the definition of bitwise not operator:

    11.4.8 bit-over na operator ( ~ )
    output < Code> UnaryExpression: ~ UnaryExpression is evaluated as follows: Give results of the evaluation of expr to unaryExpression .
    2. Old Value yes toInt32 (GetValue (expr)) .
    3. Return the result of applying a bitis supplement for old current , the result is a signed 32-bit integer.

    Any decent implementation will be able to deal with these skills, the internal integer from numbers and refunds will be avoided to avoid unnecessary conversions.

Comments