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; }
// 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); }
CppInt32__::CppInt32__(const Dynamic &inD) : mValue(inD->__ToInt()) { }