Subversion Repositories Kolibri OS

Rev

Rev 6934 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. #include <linux/export.h>
  2. #include <linux/kernel.h>
  3. #include <linux/math64.h>
  4.  
  5. s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder)
  6. {
  7.         u64 quotient;
  8.  
  9.         if (dividend < 0) {
  10.                 quotient = div_u64_rem(-dividend, abs(divisor), (u32 *)remainder);
  11.                 *remainder = -*remainder;
  12.                 if (divisor > 0)
  13.                         quotient = -quotient;
  14.         } else {
  15.                 quotient = div_u64_rem(dividend, abs(divisor), (u32 *)remainder);
  16.                 if (divisor < 0)
  17.                         quotient = -quotient;
  18.         }
  19.         return quotient;
  20. }
  21.  
  22.