text: Consider the following code (in C++11):
  int a = -11, b = 3;
  int c = a / b;
  // now c == -3
  int div_neg(int dividend, int divisor){
  if(dividend >= 0) return dividend / divisor;
  else return (dividend - divisor + 1) / divisor;
  }
  I'm not aware of any intrinsics for it. I would simply apply a correction to standard division retrospectively.
  int div_floor(int a, int b) { int res = a / b; int rem = a % b; // Correct division result downwards if up-rounding happened, // (for non-zero remainder of sign different than the divisor). int corr = (rem != 0 && ((rem < 0) != (b < 0))); return res - corr; }
  Note it also works for pre-C99 and pre-C++11, i.e. without standarization of rounding division towards zero.