Lines Matching refs:val
41 static int bitLength(BigInteger val) {
42 val.prepareJavaRepresentation();
43 if (val.sign == 0) {
46 int bLength = (val.numberLength << 5);
47 int highDigit = val.digits[val.numberLength - 1];
49 if (val.sign < 0) {
50 int i = val.getFirstNonzeroDigit();
52 if (i == val.numberLength - 1) {
62 static int bitCount(BigInteger val) {
63 val.prepareJavaRepresentation();
66 if (val.sign == 0) {
70 int i = val.getFirstNonzeroDigit();
71 if (val.sign > 0) {
72 for ( ; i < val.numberLength; i++) {
73 bCount += Integer.bitCount(val.digits[i]);
77 bCount += Integer.bitCount(-val.digits[i]);
78 for (i++; i < val.numberLength; i++) {
79 bCount += Integer.bitCount(~val.digits[i]);
82 bCount = (val.numberLength << 5) - bCount;
89 * must be in the range {@code [0, val.bitLength()-1]}
91 static boolean testBit(BigInteger val, int n) {
92 val.prepareJavaRepresentation();
93 // PRE: 0 <= n < val.bitLength()
94 return ((val.digits[n >> 5] & (1 << (n & 31))) != 0);
117 int val = source[i];
118 result[i] = (val << 1) | carry;
119 carry = val >>> 31;
213 static BigInteger flipBit(BigInteger val, int n){
214 val.prepareJavaRepresentation();
215 int resSign = (val.sign == 0) ? 1 : val.sign;
218 int resLength = Math.max(intCount + 1, val.numberLength) + 1;
223 System.arraycopy(val.digits, 0, resDigits, 0, val.numberLength);
225 if (val.sign < 0) {
226 if (intCount >= val.numberLength) {
229 //val.sign<0 y intCount < val.numberLength
230 int firstNonZeroDigit = val.getFirstNonzeroDigit();
250 } else {//case where val is positive