Lines Matching defs:num

39 #define num_zerop(num) ((num.low | num.high) == 0)
461 append_digit (cpp_num num, int digit, int base, size_t precision)
483 overflow = !!(num.high >> (PART_PRECISION - shift));
484 result.high = num.high << shift;
485 result.low = num.low << shift;
486 result.high |= num.low >> (PART_PRECISION - shift);
487 result.unsignedp = num.unsignedp;
491 add_low = num.low << 1;
492 add_high = (num.high << 1) + (num.low >> (PART_PRECISION - 1));
512 num.low = result.low;
513 num.high = result.high;
515 if (!num_eq (result, num))
1079 num_trim (cpp_num num, size_t precision)
1085 num.high &= ((cpp_num_part) 1 << precision) - 1;
1090 num.low &= ((cpp_num_part) 1 << precision) - 1;
1091 num.high = 0;
1094 return num;
1099 num_positive (cpp_num num, size_t precision)
1104 return (num.high & (cpp_num_part) 1 << (precision - 1)) == 0;
1107 return (num.low & (cpp_num_part) 1 << (precision - 1)) == 0;
1113 cpp_num_sign_extend (cpp_num num, size_t precision)
1115 if (!num.unsignedp)
1121 && (num.high & (cpp_num_part) 1 << (precision - 1)))
1122 num.high |= ~(~(cpp_num_part) 0 >> (PART_PRECISION - precision));
1124 else if (num.low & (cpp_num_part) 1 << (precision - 1))
1127 num.low |= ~(~(cpp_num_part) 0 >> (PART_PRECISION - precision));
1128 num.high = ~(cpp_num_part) 0;
1132 return num;
1137 num_negate (cpp_num num, size_t precision)
1141 copy = num;
1142 num.high = ~num.high;
1143 num.low = ~num.low;
1144 if (++num.low == 0)
1145 num.high++;
1146 num = num_trim (num, precision);
1147 num.overflow = (!num.unsignedp && num_eq (num, copy) && !num_zerop (num));
1149 return num;
1244 num_rshift (cpp_num num, size_t precision, size_t n)
1247 bool x = num_positive (num, precision);
1249 if (num.unsignedp || x)
1255 num.high = num.low = sign_mask;
1260 num.high = sign_mask, num.low |= sign_mask << precision;
1262 num.high |= sign_mask << (precision - PART_PRECISION);
1267 num.low = num.high;
1268 num.high = sign_mask;
1273 num.low = (num.low >> n) | (num.high << (PART_PRECISION - n));
1274 num.high = (num.high >> n) | (sign_mask << (PART_PRECISION - n));
1278 num = num_trim (num, precision);
1279 num.overflow = false;
1280 return num;
1285 num_lshift (cpp_num num, size_t precision, size_t n)
1289 num.overflow = !num.unsignedp && !num_zerop (num);
1290 num.high = num.low = 0;
1297 orig = num;
1301 num.high = num.low;
1302 num.low = 0;
1306 num.high = (num.high << m) | (num.low >> (PART_PRECISION - m));
1307 num.low <<= m;
1309 num = num_trim (num, precision);
1311 if (num.unsignedp)
1312 num.overflow = false;
1315 maybe_orig = num_rshift (num, precision, n);
1316 num.overflow = !num_eq (orig, maybe_orig);
1320 return num;
1325 num_unary_op (cpp_reader *pfile, cpp_num num, enum cpp_ttype op)
1333 num.overflow = false;
1337 num = num_negate (num, CPP_OPTION (pfile, precision));
1341 num.high = ~num.high;
1342 num.low = ~num.low;
1343 num = num_trim (num, CPP_OPTION (pfile, precision));
1344 num.overflow = false;
1348 num.low = num_zerop (num);
1349 num.high = 0;
1350 num.overflow = false;
1351 num.unsignedp = false;
1355 return num;