예제 #1
0
파일: Dynamic.cpp 프로젝트: cbatson/hxcpp
double Dynamic::operator%(const Dynamic &inRHS) const
{
   if (mPtr->__GetType()==vtInt && inRHS.mPtr->__GetType()==vtInt)
      return mPtr->__ToInt() % inRHS->__ToInt();
   double lhs = mPtr->__ToDouble();
   double rhs = inRHS->__ToDouble();
   int even = (int)(lhs/rhs);
   double remain = lhs - even * rhs;
   if (remain<0) remain += fabs(rhs);
   return remain;
}
예제 #2
0
파일: Array.cpp 프로젝트: motion-twin/hxcpp
// Set numeric values to 0, pointers to null, bools to false
void ArrayBase::zero(Dynamic inFirst, Dynamic inCount)
{
   int first = inFirst==null() ? 0 : inFirst->__ToInt();
   if (first<0)
      first+=length;
   if (first<0 || first>=length)
      return;

   int count = length;
   if (inCount!=null())
      count = inCount->__ToInt();
   if (count<0)
      count += length;
   if (count<0)
      return;

   if (first+count > length)
      count = length - first;

   int size = GetElementSize();
   memset(mBase + first*size, 0, count*size);
}
예제 #3
0
파일: Dynamic.cpp 프로젝트: cbatson/hxcpp
CppInt32__::CppInt32__(const Dynamic &inD) : mValue(inD->__ToInt()) { }