Example #1
0
 public static void op2_quotient(SObject arg1, SObject arg2)
 {
     if (arg1 is SFixnum & arg2 is SFixnum)
     {
         int a = ((SFixnum)arg1).value;
         int b = ((SFixnum)arg2).value;
         if (b != 0)
         {
             int result = a / b;
             Reg.Result = Factory.makeFixnum(result);
             return;
         }
         else
         {
             Exn.fault(Constants.EX_QUOTIENT, "division by zero", arg1, arg2);
             return;
         }
     }
     else if (arg1 is SByteVL & arg2 is SFixnum)
     {
         SByteVL a = (SByteVL)arg1;
         int     b = ((SFixnum)arg2).value;
         if (b == 0)
         {
             Exn.fault(Constants.EX_QUOTIENT, "division by zero", arg1, arg2);
             return;
         }
         if (b > 0 &&
             a.tag == Tags.BignumTag &&
             Number.getBignumLength(a) == 1 &&
             Number.getBignumSign(a) == Number.BIGNUM_POSITIVE)
         {
             // Exn.msg.WriteLine("++++ doing bignum quotient in millicode");
             uint av     = a.getUInt32(1);
             uint result = av / (uint)b;
             Reg.Result = Factory.makeNumber(result);
             return;
         }
     }
     Call.callMillicodeSupport2(Constants.MS_HEAVY_QUOTIENT, arg1, arg2);
     return; // TAIL CALL
 }
Example #2
0
 // getBignumLength returns the number of data words in the bignum
 public static int getBignumLength(SByteVL b) {
     return BIGNUM_LENGTH_MASK & (int) b.getUInt32(BIGNUM_LENGTH_OFFSET);
 }
Example #3
0
 // getBignumLength returns the number of data words in the bignum
 public static int getBignumLength(SByteVL b)
 {
     return(BIGNUM_LENGTH_MASK & (int)b.getUInt32(BIGNUM_LENGTH_OFFSET));
 }