JavaScript is disabled on your browser.
Skip navigation links
  • Summary:
  • Nested |
  • Field |
  • Constr |
  • Method
  • Detail:
  • Field |
  • Constr |
  • Method
gnu.math

Class BitOps



  • public class BitOps
    extends java.lang.Object
    Implements logical (bit-wise) operations on infinite-precision integers. There are no BitOps object - all the functions here are static. The semantics used are the same as for Common Lisp.
    • Method Summary

      All Methods
      Modifier and Type Method and Description
      static IntNum and (IntNum x, int y)
      Return the logical (bit-wise) "and" of an IntNum and an int.
      static IntNum and (IntNum x, IntNum y)
      Return the logical (bit-wise) "and" of two IntNums.
      static int bitCount (int i)
      static int bitCount (int[] x, int len)
      static int bitCount (IntNum x)
      Count one bits in an IntNum.
      static IntNum bitOp (int op, IntNum x, IntNum y)
      Do one the the 16 possible bit-wise operations of two IntNums.
      static boolean bitValue (IntNum x, int bitno)
      Return the value of a specified bit in an IntNum.
      static IntNum extract (IntNum x, int startBit, int endBit)
      Extract a bit-field as an unsigned integer.
      static IntNum ior (IntNum x, IntNum y)
      Return the logical (bit-wise) "(inclusive) or" of two IntNums.
      static int lowestBitSet (int i)
      static int lowestBitSet (IntNum x)
      static IntNum makeMask (int startBit, int endBit)
      Create a mask with bits true form bits form startBit to endBit.
      static IntNum not (IntNum x)
      Return the logical (bit-wise) negation of an IntNum.
      static IntNum reverseBits (IntNum x, int start, int end)
      static void setBitOp (IntNum result, int op, IntNum x, IntNum y)
      Do one the the 16 possible bit-wise operations of two IntNums.
      static IntNum setBitValue (IntNum x, int bitno, int newValue)
      Set the value of a specified bit in an IntNum.
      static int shift (int x, int count)
      static long shift (long x, int count)
      static int shiftUnsigned (int x, int count)
      static long shiftUnsigned (long x, int count)
      static int swappedOp (int op)
      Return the boolean opcode (for bitOp) for swapped operands.
      static boolean test (IntNum x, int y)
      Return true iff an IntNum and an int have any true bits in common.
      static boolean test (IntNum x, IntNum y)
      Return true iff two IntNums have any true bits in common.
      static IntNum xor (IntNum x, IntNum y)
      Return the logical (bit-wise) "exclusive or" of two IntNums.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • bitValue

        public static boolean bitValue(IntNum x,
         int bitno)
        Return the value of a specified bit in an IntNum.
      • setBitValue

        public static IntNum setBitValue(IntNum x,
         int bitno,
         int newValue)
        Set the value of a specified bit in an IntNum.
      • test

        public static boolean test(IntNum x,
         int y)
        Return true iff an IntNum and an int have any true bits in common.
      • test

        public static boolean test(IntNum x,
         IntNum y)
        Return true iff two IntNums have any true bits in common.
      • and

        public static IntNum and(IntNum x,
         int y)
        Return the logical (bit-wise) "and" of an IntNum and an int.
      • and

        public static IntNum and(IntNum x,
         IntNum y)
        Return the logical (bit-wise) "and" of two IntNums.
      • ior

        public static IntNum ior(IntNum x,
         IntNum y)
        Return the logical (bit-wise) "(inclusive) or" of two IntNums.
      • xor

        public static IntNum xor(IntNum x,
         IntNum y)
        Return the logical (bit-wise) "exclusive or" of two IntNums.
      • not

        public static IntNum not(IntNum x)
        Return the logical (bit-wise) negation of an IntNum.
      • swappedOp

        public static int swappedOp(int op)
        Return the boolean opcode (for bitOp) for swapped operands. I.e. bitOp (swappedOp(op), x, y) == bitOp (op, y, x).
      • bitOp

        public static IntNum bitOp(int op,
         IntNum x,
         IntNum y)
        Do one the the 16 possible bit-wise operations of two IntNums.
      • setBitOp

        public static void setBitOp(IntNum result,
         int op,
         IntNum x,
         IntNum y)
        Do one the the 16 possible bit-wise operations of two IntNums.
      • makeMask

        public static IntNum makeMask(int startBit,
         int endBit)
        Create a mask with bits true form bits form startBit to endBit.
      • extract

        public static IntNum extract(IntNum x,
         int startBit,
         int endBit)
        Extract a bit-field as an unsigned integer.
      • lowestBitSet

        public static int lowestBitSet(int i)
      • lowestBitSet

        public static int lowestBitSet(IntNum x)
      • bitCount

        public static int bitCount(int i)
      • bitCount

        public static int bitCount(int[] x,
         int len)
      • bitCount

        public static int bitCount(IntNum x)
        Count one bits in an IntNum. If argument is negative, count zero bits instead.
      • reverseBits

        public static IntNum reverseBits(IntNum x,
         int start,
         int end)
      • shift

        public static int shift(int x,
         int count)
      • shiftUnsigned

        public static int shiftUnsigned(int x,
         int count)
      • shift

        public static long shift(long x,
         int count)
      • shiftUnsigned

        public static long shiftUnsigned(long x,
         int count)
Skip navigation links
  • Summary:
  • Nested |
  • Field |
  • Constr |
  • Method
  • Detail:
  • Field |
  • Constr |
  • Method

AltStyle によって変換されたページ (->オリジナル) /