hphp/runtime/base/tv-arith.cpp
// Helper for converting String, Array, Bool, Null or Obj to Dbl|Int.
// Other types (i.e. Int and Double) must be handled outside of this.
Helper for converting String, Array, Bool, Null or Obj to Dbl|Int.
Other types  must be handled outside of this.
Helper for converting String Array Bool Null or Obj to Dbl|Int . Other types must be handled outside of this .
TypedNum numericConvHelper(Cell cell) {
  assert(cellIsPlausible(cell));
  switch (cell.m_type) {
  case KindOfString:
  case KindOfStaticString: return stringToNumeric(cell.m_data.pstr);
  case KindOfBoolean:      return make_tv<KindOfInt64>(cell.m_data.num);
  case KindOfUninit:
  case KindOfNull:         return make_tv<KindOfInt64>(0);
  case KindOfObject:       return make_tv<KindOfInt64>(
                             cell.m_data.pobj->o_toInt64());
  case KindOfResource:     return make_tv<KindOfInt64>(
                             cell.m_data.pres->o_toInt64());
  case KindOfArray:        throw BadArrayOperandException();
  default:                 break;
  }
  not_reached();
}
TypedNum numericConvHelper ( Cell cell ) { assert ( cellIsPlausible ( cell ) ) ; switch ( cell . m_type ) { case KindOfString : case KindOfStaticString : return stringToNumeric ( cell . m_data . pstr ) ; case KindOfBoolean : return make_tv < KindOfInt64 > ( cell . m_data . num ) ; case KindOfUninit : case KindOfNull : return make_tv < KindOfInt64 > ( 0 ) ; case KindOfObject : return make_tv < KindOfInt64 > ( cell . m_data . pobj -> o_toInt64 ( ) ) ; case KindOfResource : return make_tv < KindOfInt64 > ( cell . m_data . pres -> o_toInt64 ( ) ) ; case KindOfArray : throw BadArrayOperandException ( ) ; default : break ; } not_reached ( ) ; }
Helper for converting String, Array, Bool, Null or Obj to Dbl|Int.
Helper for converting String Array Bool Null or Obj to Dbl|Int .