1 // 2 // div.cpp 3 // 4 // Copyright (c) Microsoft Corporation. All rights reserved. 5 // 6 // Defines div(), which performs a signed divide and returns the quotient and 7 // remainder. No validation of the arguments is done. 8 // 9 #include <stdlib.h> 10 11 12 #ifdef _MSC_VER 13 #pragma function(div) 14 #endif 15 extern "C" div_t __cdecl div(int const numerator, int const denominator) 16 { 17 div_t result; 18 19 result.quot = numerator / denominator; 20 result.rem = numerator % denominator; 21 22 return result; 23 } 24