smallfn.cpp 257 B

12345678910111213141516171819
  1. #include "rar.hpp"
  2. int ToPercent(int64 N1,int64 N2)
  3. {
  4. if (N2<N1)
  5. return 100;
  6. return ToPercentUnlim(N1,N2);
  7. }
  8. // Allows the percent larger than 100.
  9. int ToPercentUnlim(int64 N1,int64 N2)
  10. {
  11. if (N2==0)
  12. return 0;
  13. return (int)(N1*100/N2);
  14. }