Beispiel #1
0
vec_ullong2 bitDiff_d2(vec_double2 ref, vec_double2 vals) {
   double ref0, ref1, vals0, vals1;
   long long refi0, refi1, valsi0, valsi1, diff0, diff1;
   vec_ullong2 bits;

   ref0 = spu_extract(ref,0);
   ref1 = spu_extract(ref,1);
   vals0 = spu_extract(vals,0);
   vals1 = spu_extract(vals,1);

   refi0 = make_ulonglong(ref0);
   refi1 = make_ulonglong(ref1);
   valsi0 = make_ulonglong(vals0);
   valsi1 = make_ulonglong(vals1);

   diff0 = refi0 - valsi0;
   diff1 = refi1 - valsi1;

   if ( diff0 < 0 )
   {
      diff0 = valsi0 - refi0;
   }

   if ( diff1 < 0 )
   {
      diff1 = valsi1 - refi1;
   }

   bits = spu_promote( (unsigned long long)ceil(log2((double)diff0)), 0 );
   bits = spu_insert( (unsigned long long)ceil(log2((double)diff1)), bits, 1 );

   return bits;
}
Beispiel #2
0
vec_ullong2 ulpDiff_d2(vec_double2 ref, vec_double2 vals) {
   double ref0, ref1, vals0, vals1;
   long long refi0, refi1, valsi0, valsi1, diff0, diff1;
   vec_ullong2 ulps;

   ref0 = spu_extract(ref,0);
   ref1 = spu_extract(ref,1);
   vals0 = spu_extract(vals,0);
   vals1 = spu_extract(vals,1);

   refi0 = make_ulonglong(ref0);
   refi1 = make_ulonglong(ref1);
   valsi0 = make_ulonglong(vals0);
   valsi1 = make_ulonglong(vals1);

   diff0 = refi0 - valsi0;
   diff1 = refi1 - valsi1;

   if ( diff0 < 0 )
   {
      diff0 = valsi0 - refi0;
   }

   if ( diff1 < 0 )
   {
      diff1 = valsi1 - refi1;
   }

   ulps = spu_promote( (unsigned long long)diff0, 0 );
   ulps = spu_insert( (unsigned long long)diff1, ulps, 1 );

   return ulps;
}
Beispiel #3
0
inline unsigned long long int get_uint_value(field_def_t *field, byte *value) {
	switch (field->fixed_length) {
		case 1: return mach_read_from_1(value);
		case 2: return mach_read_from_2(value);
		case 3: return mach_read_from_3(value) & 0x3FFFFFUL;
		case 4: return mach_read_from_4(value);
		case 8: return make_ulonglong(mach_read_from_8(value));
	}
	return 0;
}
Beispiel #4
0
//----------------------------------------------------------------------
static int outnum(ushort type, const ConstOpis *co)
{
  char  str[40];
  op_t  x;

  x.value = co->value;
  x.addr = co->value2;
#ifdef __EA64__
  x.value = make_ulonglong((uint32)x.value, (uint32)x.addr);
#endif
  x.type = o_imm;
  x.dtyp = (uchar)(type - 3);
  x.offb = 0;
  init_output_buffer(str, sizeof(str));
  OutValue(x, OOF_NUMBER | OOF_SIGNED | OOFW_IMM);
  term_output_buffer();
  tag_remove(str, str, 0);
  qfprintf(myFile, "value = %s\n", str);
  return(1);
}
Beispiel #5
0
static int ConstLoad(CIC_param ctype)
{
  ConstOpis cntopis;
  uchar     i;

  cmd.Op1.type = o_cpool;
//  cmd.Op1.ref = 0;

  if ( !cmd.Op1.cp_ind ) goto dmpchk;  //NULL Ptr

  if ( !LoadOpis(cmd.Op1.cp_ind, 0, &cntopis) ) goto dmpchk;

#ifdef __BORLANDC__
#if ( offsetof(ConstOpis,flag) != (offsetof(ConstOpis,type) + sizeof(uchar) ) \
     || (sizeof(cntopis.type) != sizeof(uchar))      \
     || (sizeof(cntopis.flag) != sizeof(uchar))      \
     || (sizeof(cmd.Op1.cp_type) < (2*sizeof(uchar))) \
     || (sizeof(ushort) != sizeof(cmd.Op1.cp_type)))
#error
#endif
#endif
  cmd.Op1.cp_type = *((ushort *)&cntopis.type);
  i = cntopis.type;

  switch ( ctype ) {
    case C_Class:
      if ( i != CONSTANT_Class ) break;
      //PASS THRU
    case C_4byte: // ldc/ldcw
      switch ( i ) {
        case CONSTANT_Class:
          if ( !(cntopis.flag & HAS_CLSNAME) ) goto wrnret;
          cmd.Op1.addr  = 0x10001ul * (ushort)fmt_fullname;
loadref1:
          cmd.xtrn_ip   = cntopis.ref_ip;
          //PASS THRU
        case CONSTANT_Integer:
        case CONSTANT_Float:
        case CONSTANT_String:
          cmd.Op1.value = cntopis.value;  // for string index to Utf8
          return(1);                      // or TWO index for other
        default:
          break;
      }
      break;

    case C_8byte:
      if ( i == CONSTANT_Long || i == CONSTANT_Double ) goto load2;
      break;

    case C_Field:
      if ( i != CONSTANT_Fieldref ) break;
      if ( (cntopis.flag & NORM_FIELD) != NORM_FIELD ) goto wrnret;
loadref2:
      cmd.xtrn_ip   = cntopis.ref_ip;
load2:
      cmd.Op1.addr  = cntopis.value2;
      cmd.Op1.value = cntopis.value;     // for string index to Utf8
#ifdef __EA64__
      cmd.Op1.value = make_ulonglong(int32(cmd.Op1.value), uint32(cmd.Op1.addr));
#endif
      return 1;

    case C_Interface:
      if ( i == CONSTANT_InterfaceMethodref ) goto methodchk;
      break;
    case C_Method:
      if ( i != CONSTANT_Methodref ) break;
methodchk:
      if ( (cntopis.flag & NORM_METOD) == NORM_METOD ) goto loadref2; //load 3 ind. & xtrn_ref
      goto wrnret;

    case C_Type:
      if ( i != CONSTANT_Class ) break;
      if ( !(cntopis.flag & HAS_TYPEDSCR) ) goto wrnret;
      cmd.Op1.addr = ((uint32)fmt_dscr << 16) | (ushort)fmt_classname;
      goto loadref1; //load 1 ind.

    case C_TypeName:
      if ( i != CONSTANT_Class ) break;
      if ( !(cntopis.flag & (HAS_TYPEDSCR | HAS_CLSNAME)) ) goto wrnret;
      cmd.Op1.addr = ((uint32)fmt_cast << 16) | (ushort)
                                            ((cntopis.flag & HAS_CLSNAME) ?
                                               fmt_fullname : fmt_classname);
      goto loadref1; //load 1 ind.

    default:
      warning("Illegal CIC call (%x)\n", ctype);
      return(0);
  }
dmpchk:
  if ( !debugmode) return(0 );
  ++cmd.Op1.ref;
wrnret:
  ++cmd.Op1.ref;
  cmd.Op1.addr_shorts.low = cmd.Op1.cp_ind;    // for dmp out
  return(1);
}